@@ -462,14 +462,39 @@ instance Read UUID where
463instance Storable UUID where
463instance Storable UUID where
464 sizeOf _ = 16
464 sizeOf _ = 16
465− alignment _ = 1 -- UUIDs are stored as individual octets
465+ alignment _ = 4
467 peekByteOff p off =
467 peekByteOff p off =
468− mapM (peekByteOff p) [off..(off+15)] >>= return . fromJust . fromList
468+ pack <$>
470+ <$> peekByteOff p off -- Word32
471+ <*> peekByteOff p (off+4) -- Word16
472+ <*> peekByteOff p (off+6) -- Word16
473+ <*> peekByteOff p (off+8) -- Word8
474+ <*> peekByteOff p (off+9) -- Word8
475+ <*> peekByteOff p (off+10) -- Word8
476+ <*> peekByteOff p (off+11) -- Word8
477+ <*> peekByteOff p (off+12) -- Word8
478+ <*> peekByteOff p (off+13) -- Word8
479+ <*> peekByteOff p (off+14) -- Word8
480+ <*> peekByteOff p (off+15) -- Word8
470 pokeByteOff p off u =
483 pokeByteOff p off u =
471− sequence_ $ zipWith (pokeByteOff p) [off..] (toList u)
484+ case unpack u of
472−
485+ (UnpackedUUID x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) ->
487+ pokeByteOff p off x0
488+ pokeByteOff p (off+4) x1
489+ pokeByteOff p (off+6) x2
490+ pokeByteOff p (off+8) x3
491+ pokeByteOff p (off+9) x4
492+ pokeByteOff p (off+10) x5
493+ pokeByteOff p (off+11) x6
494+ pokeByteOff p (off+12) x7
495+ pokeByteOff p (off+13) x8
496+ pokeByteOff p (off+14) x9
497+ pokeByteOff p (off+15) x10
474instance Binary UUID where
499instance Binary UUID where
475 put (UUID w0 w1 w2 w3) =
500 put (UUID w0 w1 w2 w3) =