X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=wavpack.git;a=blobdiff_plain;f=Codec%2FAudio%2FWavPack%2FMetadata.hs;h=edf76f25093b9afea31f71bdb2839725d73a2b79;hp=0b8d3ebbb060f6bbdd9ea269fabf19fe401a1d61;hb=2517b901b0a78840af1a025c98b23f6b90d771d8;hpb=ccc5bb864714f7f2ece125681e746c7e69938d93 diff --git a/Codec/Audio/WavPack/Metadata.hs b/Codec/Audio/WavPack/Metadata.hs index 0b8d3eb..edf76f2 100644 --- a/Codec/Audio/WavPack/Metadata.hs +++ b/Codec/Audio/WavPack/Metadata.hs @@ -52,17 +52,17 @@ instance Binary SubBlock where isLarge = idWord .&. 0x80 ≢ 0 rawID = idWord .&. (complement 0x40) .&. (complement 0x80) adj = if isOdd then -1 else 0 - size ← if isLarge then - do sz0 ← getWord8 - sz1 ← getWord8 - sz2 ← getWord8 - return $ ( (fromIntegral sz2 `shiftL` 17) .|. - (fromIntegral sz1 `shiftL` 9) .|. - (fromIntegral sz0 `shiftL` 1) - ) + adj - else - fmap ((+ adj) ∘ (`shiftL` 1) ∘ fromIntegral) getWord8 - subb ← getLazyByteString $ fromIntegral (size ∷ Word32) + size ← if isLarge then + do sz0 ← getWord8 + sz1 ← getWord8 + sz2 ← getWord8 + return $ ( (fromIntegral sz2 `shiftL` 17) .|. + (fromIntegral sz1 `shiftL` 9) .|. + (fromIntegral sz0 `shiftL` 1) + ) + adj + else + fmap ((+ adj) ∘ (`shiftL` 1) ∘ fromIntegral) getWord8 + subb ← getLazyByteString $ fromIntegral (size ∷ Word32) return $ runGet (getSubBlock rawID) subb where getSubBlock ∷ Word8 → Get SubBlock