From: Arjen M. <arj...@wl...> - 2006-02-09 08:15:36
|
Hello all, the math::bignum module implements a right bitshift operation for arbitrary-size integers. The problem is that the current version does not produce the same results as you get with Tcl's >> operator for negative numbers (See bug #1098051 on SF). The problem, however, I encountered when trying to fix this bug is that C's definition of the operation uses the fact that signed integers are implemented via two's-complement bit patterns. The sign bit is used to pad the bit pattern that arises with right shifting the bits. Now, this is fine with a fixed and finite number of bits that represent the integer, but the idea of bignum is that you have an arbitrary range for the integers. And there is no two's complement implementation of the sign. So, my question is: Should we strive to make rshift produce the _same_ results as Tcl's >> operator? If so, how should we do this? Regards, Arjen |