Required tools for playing around with memory:
hexdump
objdump
readelf
xxd
gcore
/* | |
* Displays linux /proc/pid/stat in human-readable format | |
* | |
* Build: gcc -o procstat procstat.c | |
* Usage: procstat pid | |
* cat /proc/pid/stat | procstat | |
* | |
* Homepage: http://www.brokestream.com/procstat.html | |
* Version : 2009-03-05 | |
* |
int64_t ipow(int32_t base, uint8_t exp) { | |
static const uint8_t highest_bit_set[] = { | |
0, 1, 2, 2, 3, 3, 3, 3, | |
4, 4, 4, 4, 4, 4, 4, 4, | |
5, 5, 5, 5, 5, 5, 5, 5, | |
5, 5, 5, 5, 5, 5, 5, 5, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 255, // anything past 63 is a guaranteed overflow with base > 1 |