Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Add rshift #55

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions example_byteslice_littleendian_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,25 @@ func ExampleRSet() {
fmt.Printf("%x\n", RSet(data, setData))
// Output: bada55
}

func ExampleRUnset() {
data := []byte{0xDA, 0x99, 0xBA}
unsetData := []byte{0xAD, 0x11, 0xAB}
fmt.Printf("%x\n", RUnset(data, unsetData))
// Output: 8811aa
}

func ExampleRToogle() {
data := []byte{0xDA, 0x99, 0xBA}
toogleData := []byte{0xAD, 0x11, 0xAB}
fmt.Printf("%x\n", RToogle(data, toogleData))
// Output: 778811
}

func ExampleRSubset() {
data := []byte{0xDA, 0x99, 0xBA}
leastSignificantBit := (uint64)(100)
mostSignificantBit := (uint64)(101)
fmt.Printf("%x\n", RSubset(data, leastSignificantBit, mostSignificantBit))
// Output:
}
9 changes: 8 additions & 1 deletion example_byteslice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ func ExampleReverse() {

func ExampleLPad() {
data := []byte{0x55, 0xDA, 0xBA}

fmt.Printf("%x\n", LPad(data, 5, 0x22))
// Output: 222255daba
}

func ExampleRShift() {
data := []byte{0xDA, 0x99, 0xBA}
shift := uint64(16)
fmt.Printf("%x\n", RShift(data, shift))
// Output: 0000da
}