Skip to content

Use FFI for unaligned reads#235

Open
konsumlamm wants to merge 2 commits intohaskell:masterfrom
konsumlamm:unaligned-read
Open

Use FFI for unaligned reads#235
konsumlamm wants to merge 2 commits intohaskell:masterfrom
konsumlamm:unaligned-read

Conversation

@konsumlamm
Copy link
Copy Markdown
Contributor

Closes #226.

The C code uses memcpy, which operates at the byte level, so unaligned accesses are handled correctly.

In my benchmark, the FFI variant is just slightly slower than using the unaligned primops. The sizeOf calls are simplified to constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undefined behavior because of unaligned reads?

1 participant