On Wed, 26 Mar 2003, Hiddukel wrote:

> I have converted my code to use long integer vnums, and up till now I
> have had no problems with it.  Today I was trying to change
> get_random_room so that it actually gets a random room between the new
> vnum range 1 - 2,147,483,647 and what I discovered is that the call to
> number_range can't handle this.  I changed the function declaration to
> long arguments but it still hangs on this line:
> 
>     for ( power = 2; power < to; power <<= 1 )

Operator << is bitwise shift to left, each bit shift doubling the original 
value, in this case 'power' shifted once to left is same as power*2.

I bet that it hangs because the value overflows (becomes negative), thus 
never actually reaching 'to'.

---
DK



Reply via email to