summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Cmm/Utils.hs')
-rw-r--r--compiler/GHC/Cmm/Utils.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/GHC/Cmm/Utils.hs b/compiler/GHC/Cmm/Utils.hs
index 82cb75a904..00600c2d67 100644
--- a/compiler/GHC/Cmm/Utils.hs
+++ b/compiler/GHC/Cmm/Utils.hs
@@ -225,19 +225,18 @@ mkRODataLits lbl lits
mkStgWordCLit :: Platform -> StgWord -> CmmLit
mkStgWordCLit platform wd = CmmInt (fromStgWord wd) (wordWidth platform)
-packHalfWordsCLit :: DynFlags -> StgHalfWord -> StgHalfWord -> CmmLit
+packHalfWordsCLit :: Platform -> StgHalfWord -> StgHalfWord -> CmmLit
-- Make a single word literal in which the lower_half_word is
-- at the lower address, and the upper_half_word is at the
-- higher address
-- ToDo: consider using half-word lits instead
-- but be careful: that's vulnerable when reversed
-packHalfWordsCLit dflags lower_half_word upper_half_word
- = if wORDS_BIGENDIAN dflags
- then mkWordCLit platform ((l `shiftL` halfWordSizeInBits platform) .|. u)
- else mkWordCLit platform (l .|. (u `shiftL` halfWordSizeInBits platform))
+packHalfWordsCLit platform lower_half_word upper_half_word
+ = case platformByteOrder platform of
+ BigEndian -> mkWordCLit platform ((l `shiftL` halfWordSizeInBits platform) .|. u)
+ LittleEndian -> mkWordCLit platform (l .|. (u `shiftL` halfWordSizeInBits platform))
where l = fromStgHalfWord lower_half_word
u = fromStgHalfWord upper_half_word
- platform = targetPlatform dflags
---------------------------------------------------
--