From 88b79bccb9e284a809452d0c7f415d75fc5f04ff Mon Sep 17 00:00:00 2001 From: nganhkhoa Date: Thu, 29 Aug 2024 15:22:42 +0700 Subject: [PATCH] fix get bits --- macho-go/pkg/ios/macho/arm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macho-go/pkg/ios/macho/arm.c b/macho-go/pkg/ios/macho/arm.c index bd59c0e..bb82b8b 100644 --- a/macho-go/pkg/ios/macho/arm.c +++ b/macho-go/pkg/ios/macho/arm.c @@ -31,8 +31,7 @@ uint32_t get_bits(uint32_t value, uint32_t from, uint32_t to) { return (value & (1 << from)) != 0; } - int32_t mask = ~(1U << (to - from + 1)); - return (value & mask) >> from; + return (value << (31 - to)) >> (from + (31 - to)); } int is_bit_set(uint32_t value, uint32_t at) {