Commit ec9638b2 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

testsuite: Fix T4442 on 32-bit architectures

This relied on Int# being 64-bits. This is nothing a bit of CPP can't
fix, but I think the right solution would be to make out treatment of
word-size dependent types more consistent, as suggested by #11953.

Test Plan: Validate on i386

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4614
parent 1126e694
......@@ -111,6 +111,33 @@ testIntArray name0 index read write val0 len = do
(intToBytes val len)
len
#if WORD_SIZE_IN_BITS == 64
testInt64Array = testIntArray
#else
testInt64Array ::
String
-> (ByteArray# -> Int# -> Int64#)
-> (MutableByteArray# RealWorld -> Int# -> State# RealWorld
-> (# State# RealWorld, Int64# #))
-> (MutableByteArray# RealWorld -> Int# -> Int64# -> State# RealWorld
-> State# RealWorld)
-> Int
-> Int
-> IO ()
testInt64Array name0 index read write val0 len = do
doOne (name0 ++ " positive") val0
doOne (name0 ++ " negative") (negate val0)
where
doOne name val = test
name
(\arr i -> I64# (index arr i))
(\arr i s -> case read arr i s of (# s', a #) -> (# s', I# a #))
(\arr i (I64# a) s -> write arr i a s)
val
(intToBytes val len)
len
#endif
testWordArray ::
String
-> (ByteArray# -> Int# -> Word#)
......@@ -172,7 +199,7 @@ main = do
testIntArray "Int32#"
indexWord8ArrayAsInt32# readWord8ArrayAsInt32# writeWord8ArrayAsInt32#
12345678 4
testIntArray "Int64#"
testInt64Array "Int64#"
indexWord8ArrayAsInt64# readWord8ArrayAsInt64# writeWord8ArrayAsInt64#
1234567890123 8
testIntArray "Int#"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment