Skip to content

Commit 5027c94

Browse files
committed
refactor: standardize hexadecimal constants to lowercase
Signed-off-by: Aofei Sheng <[email protected]>
1 parent 7b3bf4b commit 5027c94

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cameron.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func Identicon(data []byte, cell int) image.Image {
2828
var nib [32]byte
2929
for i := 0; i < 16; i++ {
3030
nib[2*i] = digest[i] >> 4 // High 4 bits.
31-
nib[2*i+1] = digest[i] & 0x0F // Low 4 bits.
31+
nib[2*i+1] = digest[i] & 0x0f // Low 4 bits.
3232
}
3333

3434
// Build the 5×5 symmetry mask.
@@ -66,8 +66,8 @@ func Identicon(data []byte, cell int) image.Image {
6666
v = (v << 4) | uint32(nib[i])
6767
}
6868
hueBits := v >> 16
69-
satBits := (v >> 8) & 0xFF
70-
lgtBits := v & 0xFF
69+
satBits := (v >> 8) & 0xff
70+
lgtBits := v & 0xff
7171
h := float64(hueBits) * 360 / 4095
7272
s := 65.0 - float64(satBits)*20/255
7373
l := 75.0 - float64(lgtBits)*20/255

cameron_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ func TestIdenticon(t *testing.T) {
4141
t.Run("EmptyInputs", func(t *testing.T) {
4242
img := Identicon(nil, 0)
4343
got := img.Bounds()
44-
if want := image.Rect(0, 0, 6, 6); got != want {
44+
want := image.Rect(0, 0, 6, 6)
45+
if got != want {
4546
t.Errorf("got %v, want %v", got, want)
4647
}
4748
})

0 commit comments

Comments
 (0)