Every line of 'bitwise absolute value' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
356 func Abs8(val int8) int8 { 357 if val < 0 { 358 return val * -1 359 } 360 361 return val 362 }
33 func Abs(value *big.Int) *big.Int { 34 ret := Clone(value) 35 return ret.Neg(value) 36 }
198 func BetweenU8(val, min, max uint8) uint8 { 199 switch { 200 case val < min: 201 return min 202 case val > max: 203 return max 204 default: 205 return val 206 } 207 }
27 func Absi64(a int64) int64 { 28 if a > 0 { 29 return a 30 } else { 31 return -a 32 } 33 }
132 func constantBinaryOp(op token.Token, x, y constant.Value) (r constant.Value, err error) { 133 defer func() { 134 if x := recover(); x != nil { 135 err = fmt.Errorf("%v", x) 136 } 137 }() 138 switch op { 139 case token.SHL, token.SHR: 140 n, _ := constant.Uint64Val(y) 141 r = constant.Shift(x, op, uint(n)) 142 case token.EQL, token.NEQ, token.LSS, token.LEQ, token.GTR, token.GEQ: 143 r = constant.MakeBool(constant.Compare(x, op, y)) 144 default: 145 r = constant.BinaryOp(x, op, y) 146 } 147 return r, nil 148 }
7 func BigCmpAbs(x, y *big.Int) int { return cmpBits(x.Bits(), y.Bits()) }
528 func (z80 *Z80) sra(value byte) byte { 529 z80.f = value & FLAG_C 530 value = (value & 0x80) | (value >> 1) 531 z80.f |= sz53pTable[value] 532 return value 533 }
616 func OpSHR_uint_uint8(x uint, y uint8) uint { 617 return x >> y 618 }