MCPcopy Create free account
hub / github.com/blues/note / binExtractInt40

Method binExtractInt40

lib/bulk.go:282–294  ·  view source on GitHub ↗
(ctx context.Context, what string)

Source from the content-addressed store, hash-verified

280}
281
282func (tmplContext *BulkTemplateContext) binExtractInt40(ctx context.Context, what string) (value int64) {
283 bin, success := tmplContext.binExtract(ctx, what, 5)
284 if !success {
285 return
286 }
287 // Sign extend from 40 bits
288 value = int64(bin[0])
289 value = value | (int64(bin[1]) << 8)
290 value = value | (int64(bin[2]) << 16)
291 value = value | (int64(bin[3]) << 24)
292 value = value | (int64(int8(bin[4])) << 32) // Sign extend from byte 4
293 return value
294}
295
296func (tmplContext *BulkTemplateContext) binExtractUint40(ctx context.Context, what string) (value uint64) {
297 bin, success := tmplContext.binExtract(ctx, what, 5)

Callers 1

BulkDecodeNextEntryMethod · 0.95

Calls 1

binExtractMethod · 0.95

Tested by

no test coverage detected