diff options
Diffstat (limited to 'src/math/bits/example_test.go')
| -rw-r--r-- | src/math/bits/example_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/bits/example_test.go b/src/math/bits/example_test.go index dd400da0fe..18e026b9b4 100644 --- a/src/math/bits/example_test.go +++ b/src/math/bits/example_test.go @@ -86,33 +86,41 @@ func ExampleOnesCount64() { func ExampleRotateLeft8() { fmt.Printf("%08b\n", 15) fmt.Printf("%08b\n", bits.RotateLeft8(15, 2)) + fmt.Printf("%08b\n", bits.RotateLeft8(15, -2)) // Output: // 00001111 // 00111100 + // 11000011 } func ExampleRotateLeft16() { fmt.Printf("%016b\n", 15) fmt.Printf("%016b\n", bits.RotateLeft16(15, 2)) + fmt.Printf("%016b\n", bits.RotateLeft16(15, -2)) // Output: // 0000000000001111 // 0000000000111100 + // 1100000000000011 } func ExampleRotateLeft32() { fmt.Printf("%032b\n", 15) fmt.Printf("%032b\n", bits.RotateLeft32(15, 2)) + fmt.Printf("%032b\n", bits.RotateLeft32(15, -2)) // Output: // 00000000000000000000000000001111 // 00000000000000000000000000111100 + // 11000000000000000000000000000011 } func ExampleRotateLeft64() { fmt.Printf("%064b\n", 15) fmt.Printf("%064b\n", bits.RotateLeft64(15, 2)) + fmt.Printf("%064b\n", bits.RotateLeft64(15, -2)) // Output: // 0000000000000000000000000000000000000000000000000000000000001111 // 0000000000000000000000000000000000000000000000000000000000111100 + // 1100000000000000000000000000000000000000000000000000000000000011 } func ExampleReverse8() { |
