Skip to content

Use Number instead of Int for read #25

@matthewleon

Description

@matthewleon

I've made a branch here to show this in a test: https://github.com/matthewleon/purescript-node-buffer/tree/uint32-test

Relevant code:

testUInt32 :: Test
testUInt32 = do
  buf <- fromArray [-1, -1, -1, -1]
  readVal <- read UInt32LE 0 buf
  logShow readVal -- 4294967295
  logShow $ readVal - 1 -- -2
  -- chaos reigns: try to uncomment the line below
  --logShow $ readVal == 4294967295

Purescript Ints really don't play nice with these operations. They probably require something like https://github.com/zaquest/purescript-uint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions