mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
On development genome skim tools
This commit is contained in:
@ -145,7 +145,7 @@ func (u Uint128) Mul(v Uint128) Uint128 {
|
||||
p2, p3 := bits.Mul64(u.w0, v.w1)
|
||||
hi, c0 := bits.Add64(hi, p1, 0)
|
||||
hi, c1 := bits.Add64(hi, p3, c0)
|
||||
if (u.w1 != 0 && v.w1 != 0) || p0 != 0 || p2 != 0 || c1 != 0 {
|
||||
if p0 != 0 || p2 != 0 || c1 != 0 {
|
||||
log.Panicf("Uint128 overflow at Mul(%v, %v)", u, v)
|
||||
}
|
||||
return Uint128{w1: hi, w0: lo}
|
||||
|
@ -94,11 +94,14 @@ func (u Uint64) LeftShift64(n uint, carryIn uint64) (value, carry uint64) {
|
||||
|
||||
case n == 64:
|
||||
return carryIn, u.w0
|
||||
|
||||
case n < 128:
|
||||
return carryIn, u.w0 << (n - 64)
|
||||
|
||||
}
|
||||
|
||||
log.Warnf("Uint64 overflow at LeftShift64(%v, %v)", u, n)
|
||||
return 0, 0
|
||||
|
||||
}
|
||||
|
||||
// RightShift64 performs a right shift operation on the Uint64 value by n bits, with carry-out to carry.
|
||||
@ -117,10 +120,13 @@ func (u Uint64) RightShift64(n uint, carryIn uint64) (value, carry uint64) {
|
||||
return u.w0, 0
|
||||
|
||||
case n < 64:
|
||||
return u.w0>>n | (carryIn & ^((1 << (64 - n)) - 1)), u.w0 << (n - 64)
|
||||
return u.w0>>n | (carryIn & ^((1 << (64 - n)) - 1)), u.w0 << (64 - n)
|
||||
|
||||
case n == 64:
|
||||
return carryIn, u.w0
|
||||
|
||||
case n < 128:
|
||||
return carryIn, u.w0 >> (n - 64)
|
||||
}
|
||||
|
||||
log.Warnf("Uint64 overflow at RightShift64(%v, %v)", u, n)
|
||||
|
Reference in New Issue
Block a user