Skip to content
  • Julian Seward's avatar
    [project @ 2001-12-07 11:34:48 by sewardj] · 5861bb81
    Julian Seward authored
    Change the story on shifting primops: SllOp, SrlOp, ISllOp, ISraOp, ISrlOp.
    
    In the old primop story, these were implemented by C macros which
    checked that the shift amount did not exceed the word size, and if so
    returns a suitable value (0 or -1).  This gives consistent, defined
    behaviour for any shift amount.  However, these checks were not
    implemented on the NCG route, an inconsistency.
    
    New story: these primops do NOT check their args; they just do the shift.
    Shift values >= word size give undefined results.  To reflect this, their
    Haskell names have been prefixed with 'unchecked'.
    
    The checks are now done on the Bits instances in the Prelude.  This means
    all code generation routes are consistently checked, and hopefully the
    simplifier will remove the checks for literal shift amounts.
    
    I have tried to fix up the implementation for 64-bit platforms too, but
    not having one to hand, I don't know if it will work as-is.
    5861bb81