diff options
| author | 2026-03-06 04:31:54 +0800 | |
|---|---|---|
| committer | 2026-03-06 04:36:57 +0800 | |
| commit | 17eed9abe9743699b561bd5cf13a0eecbe2e27b8 (patch) | |
| tree | 684a2692ae648f2d9ac00e362cae0b8d0a215895 /internal | |
| parent | README: Learning from git, got, and git9 (diff) | |
| signature | No signature | |
format/commitgraph/bloom: Add commit-graph bloom filters
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/intconv/intconv.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/intconv/intconv.go b/internal/intconv/intconv.go index c4b429e3..8d3ac9c6 100644 --- a/internal/intconv/intconv.go +++ b/internal/intconv/intconv.go @@ -68,3 +68,12 @@ func Int64ToInt32(v int64) (int32, error) { return int32(v), nil } + +// SignExtendByteToUint32 sign-extends b as a signed 8-bit integer into uint32. +func SignExtendByteToUint32(b byte) uint32 { + if b&0x80 == 0 { + return uint32(b) + } + + return 0xFFFFFF00 | uint32(b) +} |
