forked from siderolabs/gen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update hashtriemap implementation from the latest upstream
- Run rekres and update linters. - Pull latest hashtriemap changes. - Support Go 1.24 [swissmaps](golang/go#54766). Signed-off-by: Dmitriy Matrenichev <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,296 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# syntax = docker/dockerfile-upstream:1.10.0-labs | ||
# syntax = docker/dockerfile-upstream:1.12.0-labs | ||
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2024-10-23T16:30:37Z by kres 6d3cad4. | ||
# Generated on 2024-12-09T17:41:43Z by kres 8183c20. | ||
|
||
ARG TOOLCHAIN | ||
|
||
# cleaned up specs and compiled versions | ||
FROM scratch AS generate | ||
|
||
# runs markdownlint | ||
FROM docker.io/oven/bun:1.1.32-alpine AS lint-markdown | ||
FROM docker.io/oven/bun:1.1.38-alpine AS lint-markdown | ||
WORKDIR /src | ||
RUN bun i markdownlint-cli@0.42.0 [email protected] | ||
RUN bun i markdownlint-cli@0.43.0 [email protected] | ||
COPY .markdownlint.json . | ||
COPY ./README.md ./README.md | ||
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
// Copyright 2024 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package concurrent | ||
|
||
import ( | ||
"unsafe" | ||
) | ||
|
||
// NewBadHashTrieMap creates a new HashTrieMap for the provided key and value | ||
// but with an intentionally bad hash function. | ||
func NewBadHashTrieMap[K, V comparable]() *HashTrieMap[K, V] { | ||
// Stub out the good hash function with a terrible one. | ||
// Everything should still work as expected. | ||
var m HashTrieMap[K, V] | ||
|
||
m.init() | ||
|
||
m.keyHash = func(_ unsafe.Pointer, _ uintptr) uintptr { | ||
return 0 | ||
} | ||
|
||
return &m | ||
} | ||
|
||
// NewTruncHashTrieMap creates a new HashTrieMap for the provided key and value | ||
// but with an intentionally bad hash function. | ||
func NewTruncHashTrieMap[K, V comparable]() *HashTrieMap[K, V] { | ||
// Stub out the good hash function with a terrible one. | ||
// Everything should still work as expected. | ||
var ( | ||
m HashTrieMap[K, V] | ||
mx map[string]int | ||
) | ||
|
||
hasher := efaceMapOf(mx)._type.Hasher | ||
m.keyHash = func(p unsafe.Pointer, n uintptr) uintptr { | ||
return hasher(p, n) & ((uintptr(1) << 4) - 1) | ||
} | ||
|
||
return &m | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.