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

Commit

Permalink
Merge ac7f63c into 97bd93e
Browse files Browse the repository at this point in the history
  • Loading branch information
andrideng committed Oct 30, 2017
2 parents 97bd93e + ac7f63c commit 904fdc1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
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:
}
17 changes: 16 additions & 1 deletion example_byteslice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,22 @@ 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
}

func ExampleRPad() {
data := []byte{0xDA}
length := 2
filler := byte(0x00)
fmt.Printf("%x\n", RPad(data, length, filler))
// Output: da00
}

0 comments on commit 904fdc1

Please sign in to comment.