Skip to content

Instantly share code, notes, and snippets.

@Zxilly
Created July 13, 2024 18:00
Show Gist options
  • Save Zxilly/f4ab8080af496b1ca392e5d6618fb419 to your computer and use it in GitHub Desktop.
Save Zxilly/f4ab8080af496b1ca392e5d6618fb419 to your computer and use it in GitHub Desktop.
From c36f0134350358f0723fdd12d50f37bfef67f6ff Mon Sep 17 00:00:00 2001
From: Zxilly <zxilly@outlook.com>
Date: Fri, 12 Jul 2024 22:45:00 +0800
Subject: [PATCH] internal/bytealg: extend memchr result correctly
---
src/internal/bytealg/indexbyte_wasm.s | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/internal/bytealg/indexbyte_wasm.s b/src/internal/bytealg/indexbyte_wasm.s
index ef4bd93070f44..d22e90448d43f 100644
--- a/src/internal/bytealg/indexbyte_wasm.s
+++ b/src/internal/bytealg/indexbyte_wasm.s
@@ -12,7 +12,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
I64Load b_len+8(FP)
I32WrapI64
Call memchr<>(SB)
- I64ExtendI32S
+ I64ExtendI32U
Set R0
Get SP
@@ -35,7 +35,7 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
I64Load s_len+8(FP)
I32WrapI64
Call memchr<>(SB)
- I64ExtendI32S
+ I64ExtendI32U
Set R0
I64Const $-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment