erikcharlebois/dwarf — pull request #1 by rwbarton (2013-10-11 04:40:42+00:00)
Title: Fix getSLEB128

It gave the wrong answer for most numbers below -128, due to ORing with the wrong shift of (-1).

You can reproduce the bug by creating a file `enumtest.c`:
```
enum test {
X = -1000
};

int main(void)
{
return X;
}
```
running `gcc -g -o enumtest enumtest.c`, and then using my [dwarf2enum](https://github.com/rwbarton/dwarf2enum) on the resulting executable:
```
processing enumtest.c
enum test {
X = -104,
};
```

See also https://github.com/uriba/dwarf/commit/1065dcf3843b9c2723b480eac985432283ed47f4.

I also removed the `shift < 32` test because it seems to be wrong for 64-bit quantities, and `shiftL` by any nonnegative number of bits is safe. Indeed, a similar test with `X = -1000000000000` shows that this is necessary.