Re: [polyml] Negative offset for getX and setX functions in Foreign.Memory

2016-01-18 Thread David Matthews
On 18/01/2016 10:14, Phil Clayton wrote: The intention is that they should work correctly for negative offsets. It seemed more useful that way. Word.toIntX does imply that the basis library understands signed word values. Yes - the getX/setX operations are more useful by allowing negative off

Re: [polyml] Negative offset for getX and setX functions in Foreign.Memory

2016-01-18 Thread Phil Clayton
On 16/01/2016 08:51, David Matthews wrote: On 15/01/2016 16:13, Phil Clayton wrote: The functions getX and setX in Foreign.Memory take an offset as a Word.word. I'm finding that it is possible to have a negative offset by negating the word offset, e.g. get8 (p, ~ 0w1) Is that guaranteed work

Re: [polyml] Negative offset for getX and setX functions in Foreign.Memory

2016-01-16 Thread David Matthews
On 15/01/2016 16:13, Phil Clayton wrote: The functions getX and setX in Foreign.Memory take an offset as a Word.word. I'm finding that it is possible to have a negative offset by negating the word offset, e.g. get8 (p, ~ 0w1) Is that guaranteed work generally? Given that Word.wordSize = 6

[polyml] Negative offset for getX and setX functions in Foreign.Memory

2016-01-15 Thread Phil Clayton
The functions getX and setX in Foreign.Memory take an offset as a Word.word. I'm finding that it is possible to have a negative offset by negating the word offset, e.g. get8 (p, ~ 0w1) Is that guaranteed work generally? Given that Word.wordSize = 63 SysWord.wordSize = 64 I wouldn't have