From b1fe8e0e75a1171012b4a7adb453497d218c2bec Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Mon, 11 Mar 2024 14:36:39 +0100 Subject: [PATCH] feat: convert from `i32` to `NumberOfWords` --- triton-vm/src/op_stack.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/triton-vm/src/op_stack.rs b/triton-vm/src/op_stack.rs index 079e483ba..a8bd5ca73 100644 --- a/triton-vm/src/op_stack.rs +++ b/triton-vm/src/op_stack.rs @@ -601,6 +601,14 @@ impl TryFrom for NumberOfWords { } } +impl TryFrom for NumberOfWords { + type Error = NumberOfWordsError; + + fn try_from(index: i32) -> NumWordsResult { + usize::try_from(index)?.try_into() + } +} + impl TryFrom for NumberOfWords { type Error = NumberOfWordsError;