From 3eb5c6dff0d10ac6271be0b55c299dad8c6d7ce7 Mon Sep 17 00:00:00 2001 From: Kevin Phoenix Date: Fri, 20 Sep 2024 14:58:20 -0700 Subject: [PATCH] Deduplicate code between BV.get_bytes and BV.get_byte --- claripy/ast/bv.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/claripy/ast/bv.py b/claripy/ast/bv.py index 90668a6b3..d2047878c 100644 --- a/claripy/ast/bv.py +++ b/claripy/ast/bv.py @@ -92,15 +92,7 @@ def get_byte(self, index): :param index: the byte to extract :return: An 8-bit BV """ - pos = (self.size() + 7) // 8 - 1 - index - if pos < 0: - raise ValueError( - "Incorrect index %d. Your index must be between %d and %d." % (index, 0, self.size() // 8 - 1) - ) - r = self[min(pos * 8 + 7, self.size() - 1) : pos * 8] - if r.size() % 8 != 0: # pylint:disable=no-member - r = r.zero_extend(8 - r.size() % 8) # pylint:disable=no-member - return r + return self.get_bytes(index, 1) def get_bytes(self, index, size): """