Skip to content

Commit

Permalink
Refactor: Remove superfluous wrapper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiburjack committed Aug 16, 2022
1 parent 464ee0e commit f092d8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func (thiz *decoder) decodeTextSSE(t *Token) (bool, error) {
j := thiz.r
c := 0
for thiz.w > thiz.r+c {
sidx := findFirstOpenAngleBracket16(thiz.rb[j+c : thiz.w])
sidx := openAngleBracket16(thiz.rb[j+c : thiz.w])
onlyWhitespaces = onlyWhitespaces && onlySpacesUntil16(thiz.rb[j+c:thiz.w], sidx)
c += int(sidx)
if sidx != 16 {
Expand Down Expand Up @@ -452,7 +452,7 @@ func (thiz *decoder) decodeTextAVX2(t *Token) (bool, error) {
j := thiz.r
c := 0
for thiz.w > thiz.r+c {
sidx := findFirstOpenAngleBracket32(thiz.rb[j+c : thiz.w])
sidx := openAngleBracket32(thiz.rb[j+c : thiz.w])
onlyWhitespaces = onlyWhitespaces && onlySpacesUntil32(thiz.rb[j+c:thiz.w], sidx)
c += int(sidx)
if sidx != 32 {
Expand Down
8 changes: 0 additions & 8 deletions sse_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package gosaxml
//go:noescape
func openAngleBracket16([]uint8) byte

func findFirstOpenAngleBracket16(slice []uint8) byte {
return openAngleBracket16(slice)
}

//go:noescape
func onlySpaces16([]uint8) byte

Expand All @@ -17,10 +13,6 @@ func onlySpacesUntil16(slice []uint8, n byte) bool {
//go:noescape
func openAngleBracket32([]uint8) byte

func findFirstOpenAngleBracket32(slice []uint8) byte {
return openAngleBracket32(slice)
}

//go:noescape
func onlySpaces32([]uint8) byte

Expand Down
6 changes: 3 additions & 3 deletions sse_amd64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
)

func TestFindFirstOpenAngleBracket16(t *testing.T) {
assert.Equal(t, byte(3), findFirstOpenAngleBracket16([]uint8{0x20, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}))
assert.Equal(t, byte(16), findFirstOpenAngleBracket16([]uint8{0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}))
func TestOpenAngleBracket16(t *testing.T) {
assert.Equal(t, byte(3), openAngleBracket16([]uint8{0x20, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}))
assert.Equal(t, byte(16), openAngleBracket16([]uint8{0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}))
}

func TestOnlySpaces16(t *testing.T) {
Expand Down

0 comments on commit f092d8f

Please sign in to comment.