MCPcopy Index your code
hub / github.com/Shopify/go-lua / shift

Function shift

bit32.go:12–29  ·  view source on GitHub ↗
(l *State, r uint, i int)

Source from the content-addressed store, hash-verified

10func mask(n uint) uint { return ^(math.MaxUint32 << n) }
11
12func shift(l *State, r uint, i int) int {
13 if i < 0 {
14 if i, r = -i, trim(r); i >= bitCount {
15 r = 0
16 } else {
17 r >>= uint(i)
18 }
19 } else {
20 if i >= bitCount {
21 r = 0
22 } else {
23 r <<= uint(i)
24 }
25 r = trim(r)
26 }
27 l.PushUnsigned(r)
28 return 1
29}
30
31func rotate(l *State, i int) int {
32 r := trim(CheckUnsigned(l, 1))

Callers 1

bit32.goFile · 0.85

Calls 2

trimFunction · 0.85
PushUnsignedMethod · 0.80

Tested by

no test coverage detected