Skip to content

Commit 0e55a56

Browse files
Fix ruint bug
1 parent 17b649e commit 0e55a56

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extensions/bigint/guest/src/externs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub unsafe extern "C" fn zkvm_u256_eq_impl(a: *const u8, b: *const u8) -> bool {
133133

134134
#[no_mangle]
135135
pub unsafe extern "C" fn zkvm_u256_cmp_impl(a: *const u8, b: *const u8) -> Ordering {
136-
let mut cmp_result = MaybeUninit::<crate::U256>::uninit();
136+
let mut cmp_result = MaybeUninit::<[u8; 32]>::uninit();
137137
custom_insn_r!(
138138
opcode = OPCODE,
139139
funct3 = INT256_FUNCT3,
@@ -143,7 +143,7 @@ pub unsafe extern "C" fn zkvm_u256_cmp_impl(a: *const u8, b: *const u8) -> Order
143143
rs2 = In b as *const u8
144144
);
145145
let mut cmp_result = cmp_result.assume_init();
146-
if cmp_result.as_le_bytes()[0] != 0 {
146+
if cmp_result[0] != 0 {
147147
return Ordering::Less;
148148
}
149149
custom_insn_r!(
@@ -154,15 +154,15 @@ pub unsafe extern "C" fn zkvm_u256_cmp_impl(a: *const u8, b: *const u8) -> Order
154154
rs1 = In b as *const u8,
155155
rs2 = In a as *const u8
156156
);
157-
if cmp_result.as_le_bytes()[0] != 0 {
157+
if cmp_result[0] != 0 {
158158
return Ordering::Greater;
159159
}
160160
return Ordering::Equal;
161161
}
162162

163163
#[no_mangle]
164164
pub unsafe extern "C" fn zkvm_u256_clone_impl(result: *mut u8, a: *const u8) {
165-
let zero = &crate::U256::ZERO as *const _ as *const u8;
165+
let zero = &[0u8; 32] as *const _ as *const u8;
166166
custom_insn_r!(
167167
opcode = OPCODE,
168168
funct3 = INT256_FUNCT3,

0 commit comments

Comments
 (0)