on master help sign in
Support for serializing SIMD data
b8dbd52Benjamin Saunders
idris.cabal+1−1
@@ -273,7 +273,7 @@ Executable idris
273 containers, process, transformers, filepath,
273 containers, process, transformers, filepath,
274 directory, binary, bytestring, text, pretty,
274 directory, binary, bytestring, text, pretty,
275 language-java>=0.2.2, libffi, llvm-general==3.3.3.*,
275 language-java>=0.2.2, libffi, llvm-general==3.3.3.*,
276− vector
276+ vector, vector-binary-instances
277
277
278 Extensions: MultiParamTypeClasses, FunctionalDependencies,
278 Extensions: MultiParamTypeClasses, FunctionalDependencies,
279 FlexibleInstances, TemplateHaskell
279 FlexibleInstances, TemplateHaskell
src/Idris/IBC.hs+11
@@ -11,6 +11,7 @@ import Idris.Imports
11import Idris.Error
11import Idris.Error
12
12
13import Data.Binary
13import Data.Binary
14+import Data.Vector.Binary
14import Data.List
15import Data.List
15import Data.ByteString.Lazy as B hiding (length, elem)
16import Data.ByteString.Lazy as B hiding (length, elem)
16import Control.Monad
17import Control.Monad
@@ -395,6 +396,11 @@ instance Binary Const where
395 putWord8 20
396 putWord8 20
396 putWord8 (fromIntegral . fromEnum $ ity)
397 putWord8 (fromIntegral . fromEnum $ ity)
397 putWord8 (fromIntegral count)
398 putWord8 (fromIntegral count)
399+
400+ B8V x1 -> putWord8 21 >> put x1
401+ B16V x1 -> putWord8 22 >> put x1
402+ B32V x1 -> putWord8 23 >> put x1
403+ B64V x1 -> putWord8 24 >> put x1
398 get
404 get
399 = do i <- getWord8
405 = do i <- getWord8
400 case i of
406 case i of
@@ -431,6 +437,11 @@ instance Binary Const where
431 c <- getWord8
437 c <- getWord8
432 return (AType (ATInt (ITVec (toEnum . fromIntegral $ e) (fromIntegral c))))
438 return (AType (ATInt (ITVec (toEnum . fromIntegral $ e) (fromIntegral c))))
433
439
440+ 21 -> fmap B8V get
441+ 22 -> fmap B16V get
442+ 23 -> fmap B32V get
443+ 24 -> fmap B64V get
444+
434 _ -> error "Corrupted binary data for Const"
445 _ -> error "Corrupted binary data for Const"
435
446
436
447