My Bits are Flipping (or, "Why Can't I Be Negative?")
Hello all!
I've seen something a little strange while working on Midgard, and I'm hoping
some of the other library wrapping folks out there can explain it to me, and
tell me how to fix it.
I'm currently working on mouse events in Midgard. When the mouse moves past
the left or top of the widget, the mouse position is given as a negative
number, reflecting the fact that the position is based on the widget's
coordinate system. This is to be expected, and is what happens in the shared
library part of the project.
The problem is with the Euphoria function that is being used as a callback.
The prototype for the callback function is:
-- MWidget is basically an atom.
function X(MWidget sender, integer x, integer y)
When either x or y receives a negative number from the shared library, its
picking up on the fact that the signed bit of the number is flagged.
However, it is seeing this not as a negative number, but as a huge positive
number, which of course is causing a Euphoria error because the number is too
big to be an integer.
How can I get this value, coming in from the C++ code side, to be seen by
Euphoria as a negative number? Or am I going to have to check the signed bit
manually?
Any help would be greatly appreciated!
Travis.
--
"Well," Brahma said, "even after ten thousand explanations, a fool is no
wiser, but an intelligent man requires only two thousand five hundred."
-- The Mahabharata.
|
Not Categorized, Please Help
|
|