diff options
author | Your Name <you@example.com> | 2021-11-10 18:05:29 +0000 |
---|---|---|
committer | Your Name <you@example.com> | 2021-11-10 18:05:29 +0000 |
commit | 7e1dba2e6b00f620d6ec3f1c2a75e69dcc7a82e5 (patch) | |
tree | 233928e21db382786a5aea477073ee9f2b028ae9 /frida_mode/src/util.c | |
parent | 533e979010ca338df6fc415d87668f8187752915 (diff) | |
download | afl++-7e1dba2e6b00f620d6ec3f1c2a75e69dcc7a82e5.tar.gz |
Fix block ID handling
Diffstat (limited to 'frida_mode/src/util.c')
-rw-r--r-- | frida_mode/src/util.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/frida_mode/src/util.c b/frida_mode/src/util.c index 2b0f7be6..d84b7065 100644 --- a/frida_mode/src/util.c +++ b/frida_mode/src/util.c @@ -80,3 +80,24 @@ gboolean util_output_enabled(void) { } +gsize util_rotate(gsize val, gsize shift, gsize size) { + + if (shift == 0) { return val; } + gsize result = ((val >> shift) | (val << (size - shift))); + result = result & ((1 << size) - 1); + return result; + +} + +gsize util_log2(gsize val) { + + for (gsize i = 0; i < 64; i++) { + + if (((gsize)1 << i) == val) { return i; } + + } + + FFATAL("Not a power of two"); + +} + |