stupid sign extension

master
leitner 9 years ago
parent 624412ce03
commit 05e4dcc94a

@ -5,7 +5,7 @@ size_t scan_varint(const char* in,size_t len, unsigned long long* n) {
unsigned long long l; unsigned long long l;
if (len==0) return 0; if (len==0) return 0;
for (l=0, i=0; i<len; ++i) { for (l=0, i=0; i<len; ++i) {
l+=(in[i]&0x7f) << (i*7); l+=(unsigned long long)(in[i]&0x7f) << (i*7);
if (!(in[i]&0x80)) { if (!(in[i]&0x80)) {
*n=l; *n=l;
return i+1; return i+1;

Loading…
Cancel
Save