View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum ↗

iraf-v216 · Code · Issues (50) · Pull requests (81)

iraf.net pull request #62

Fix ADDR_TO_LOC for i386 (32 bit)

merge olebole merged 2 commits to iraf-community/iraf


olebole commented on 2017-05-16

The address LOC needs to be not negative. The right shift in the original code however may be (implementation dependent) shift in a 1, resulting in a negative LOC:

ISO/IEC 9899/1999, §6.5.8:

  1. The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 / 2^E2. If E1 has a signed type and a negative value, the resulting value is implementation-defined.

We explicitly cast it into an unsigned before rightshifting. This will shift in a zero.

This fixes #61.

We can also remove an ugly “workaround” for this problem in the cl startup shell script.


Commits


Last updated on 2017-10-20