internal/lib/reflect: fix Int/Uint/Float flagIndir

This commit is contained in:
visualfc
2024-12-13 11:04:19 +08:00
parent 0c2f6c46f6
commit d2d8bd550a
2 changed files with 26 additions and 22 deletions

View File

@@ -64,14 +64,14 @@ func CountString(s string, c byte) (n int) {
// Requires 2 <= len(b) <= MaxLen.
func Index(a, b []byte) int {
for i := 0; i <= len(a)-len(b); i++ {
if equal(a[i:i+len(b)], b) {
if Equal(a[i:i+len(b)], b) {
return i
}
}
return -1
}
func equal(a, b []byte) bool {
func Equal(a, b []byte) bool {
if n := len(a); n == len(b) {
return c.Memcmp(unsafe.Pointer(unsafe.SliceData(a)), unsafe.Pointer(unsafe.SliceData(b)), uintptr(n)) == 0
}