Skip to content

Commit a146431

Browse files
author
Zilin Chen
committed
dargent: simplify array allocation
1 parent f4d26ae commit a146431

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cogent/src/Cogent/Dargent/Allocation.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ data AlignedBitRange
250250
{- * Word alignment transformations -}
251251

252252
alignSize :: Size -> Size -> Size
253-
alignSize toMultipleOf size =
254-
size + ((toMultipleOf - size `mod` toMultipleOf) `mod` toMultipleOf)
253+
alignSize toMultipleOf size = ceiling (fromIntegral size / fromIntegral toMultipleOf) * toMultipleOf
255254

256255
-- | Aligns an 'Offsettable' (assumed to initially have offset 0)
257256
-- so that its new offset is the smallest offset which is at least 'minBitOffset'

0 commit comments

Comments
 (0)