Re: [Tack-devel] SBS instruction question
Moved to https://github.com/davidgiven/ack
Brought to you by:
dtrg
From: Carl E. C. <cec...@ya...> - 2019-06-24 15:06:07
|
Greetings, Yes, what you write makes full sense, for example target em24 could potentially cause this issue, and thus cause an overflow trap if the difference was too big and did not fit in a 16-bit signed integer. So actually nothing to change. Thanks for the clarification, Carl On Monday, June 24, 2019, 3:04:05 AM GMT+8, David Given <dg...@co...> wrote: Is this for architectures where sizeof(ptr) != sizeof(int)? I believe the m68k has a mode where it can operate like that. In this situation, if two 32-bit pointers are too far apart then the result can't be represented in a 16-bit int. The em spec does say that you can only do pointer comparisons between addresses in the same fragment. On Sun, 23 Jun 2019 at 18:44, Carl Eric Codere via Tack-devel <tac...@li...> wrote: Greetings, Another interesting question on the SBS EM instruction. It seems that both em.p and the EM interpreter do overflow checking on the SBS (subtract pointer from pointer) instruction only when the word size is 16-bits. Should this be documented, and i guess if technically possible this should be the same for 32-bit pointers, right? Another simple question, is there a practical use-case where SBS is used where ptr1 - ptr2 where ptr2 is at higher address than ptr1? This gives a negative number and according to me should not be possible, right, but maybe i am missing something here... I am just curious to see if this is a valid use case. Thanks in advance, Carl _______________________________________________ Tack-devel mailing list Tac...@li... https://lists.sourceforge.net/lists/listinfo/tack-devel -- ┌─── http://www.cowlark.com ─── │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup |