Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: basvandijk/usb
...
head fork: basvandijk/usb
compare: 04ed1a6290
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 05, 2012
@basvandijk Support containers-0.5
Bumped version from 1.1.0.1 to 1.1.0.2 because of this internal change.
010a7d2
@basvandijk Lazily compute the list of digits from decodeBCD 04ed1a6
Showing with 7 additions and 7 deletions.
  1. +5 −5 Utils.hs
  2. +2 −2 usb.cabal
View
10 Utils.hs
@@ -23,7 +23,7 @@ import Foreign.Ptr ( Ptr )
import Foreign.Storable ( Storable, )
import Foreign.Marshal.Array ( peekArray )
import Data.Bool ( Bool, otherwise )
-import Data.Ord ( Ord, (<) )
+import Data.Ord ( Ord, (>) )
import Data.Bits ( Bits, shiftL, shiftR, bitSize, (.&.) )
import Data.Int ( Int )
import System.IO ( IO )
@@ -70,10 +70,10 @@ used to encode a single digit. See:
<http://en.wikipedia.org/wiki/Binary-coded_decimal>
-}
decodeBCD ∷ Bits α ⇒ Int → α → [α]
-decodeBCD bitsInDigit abcd = go shftR []
+decodeBCD bitsInDigit abcd = go 0
where
shftR = bitSize abcd - bitsInDigit
- go shftL ds | shftL < 0 = ds
- | otherwise = let !d = (abcd `shiftL` shftL) `shiftR` shftR
- in go (shftL - bitsInDigit) (d : ds)
+ go !shftL | shftL > shftR = []
+ | otherwise = let !d = (abcd `shiftL` shftL) `shiftR` shftR
+ in d : go (shftL + bitsInDigit)
View
4 usb.cabal
@@ -1,5 +1,5 @@
name: usb
-version: 1.1.0.1
+version: 1.1.0.2
cabal-version: >=1.6
build-type: Custom
license: BSD3
@@ -98,4 +98,4 @@ Library
if impl(ghc>7) && !os(windows)
cpp-options: -DHAS_EVENT_MANAGER
other-modules: Poll, Event, SystemEventManager, Timeval
- build-depends: containers >= 0.1 && < 0.5
+ build-depends: containers >= 0.1 && < 0.6

No commit comments for this range

Something went wrong with that request. Please try again.