Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Database/MySQL/Protocol/MySQLValue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,9 @@ newtype BitMap = BitMap { fromBitMap :: ByteString } deriving (Eq, Show)
--
isColumnSet :: BitMap -> Int -> Bool
isColumnSet (BitMap bitmap) pos =
let (i, j) = pos `quotRem` 8
in (bitmap `B.unsafeIndex` i) `testBit` j
let i = pos `unsafeShiftR` 3
j = pos .&. 7
in (bitmap `B.unsafeIndex` i) `testBit` j
{-# INLINE isColumnSet #-}

-- | Test if a column is null(binary protocol).
Expand All @@ -540,8 +541,11 @@ isColumnSet (BitMap bitmap) pos =
--
isColumnNull :: BitMap -> Int -> Bool
isColumnNull (BitMap nullmap) pos =
let (i, j) = (pos + 2) `quotRem` 8
in (nullmap `B.unsafeIndex` i) `testBit` j
let
pos' = pos + 2
i = pos' `unsafeShiftR` 3
j = pos' .&. 7
in (nullmap `B.unsafeIndex` i) `testBit` j
{-# INLINE isColumnNull #-}

-- | Make a nullmap for params(binary protocol) without offset.
Expand Down