Navigation Menu

Skip to content

Commit

Permalink
Made UnMarshaller::get_*_varint() work on 64 bit systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
tilman2 committed May 1, 2009
1 parent 13432e3 commit 24022e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vm/marshal.cpp
Expand Up @@ -34,7 +34,7 @@ namespace rubinius {
*done = false;

while(!*done && bytes < sizeof(long)) {
unsigned int byte = stream.get();
unsigned long byte = stream.get();

val += (byte & ~128) << shift;

Expand Down Expand Up @@ -77,6 +77,15 @@ namespace rubinius {
mp_init_set_int(&mp_val, val);
mp_init(&a);

#if (__WORDSIZE == 64)
// mp_(init_)set_int can only deal with 32 bit values,
// so the above call only copied the lower 32 bits of _val_.
// Handle the upper 32 bits as well:
mp_set_int(&a, val >> 32);
mp_mul_2d(&a, 32, &a);
mp_add(&a, &mp_val, &mp_val);
#endif

while(!done) {
unsigned int byte = stream.get();

Expand Down

0 comments on commit 24022e7

Please sign in to comment.