Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safety #8

Merged
merged 4 commits into from
Apr 1, 2020
Merged

Safety #8

merged 4 commits into from
Apr 1, 2020

Commits on Apr 1, 2020

  1. non-amd64: fix missing import

    How this was missing is beyond me.
    twmb committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    d469bd1 View commit details
    Browse the repository at this point in the history
  2. testing: only test against canonical source on LE arches

    The canonical source does the unsafe bytes to int trick. This code
    always reads as little endian. On big arches, the canonical source will
    return different results than our little endian reading, so we avoid
    testing against the canonical source on big arches.
    twmb committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    ac52452 View commit details
    Browse the repository at this point in the history
  3. all: switch to reflect for safer slice->string conversions

    Go issue 19367 (golang/go#19367)
    and a linked issue at the bottom indicate that the following trick
    
      *(*string)(unsafe.Pointer(&slice))
    
    is not theoretically safe. While I doubt that the Go people will ever
    actually break that code since it would break a loooot of other code, we
    may as well convert back to safe code. The prior commit removed reflect
    because we were converting from a string to a slice; this re-introduces
    it because converting from a slice to a string adds only 0.4ns of
    overhead but adds following the rules of Go to the letter.
    
    After this commit, this library effectively follows all rules of
    unsafety (and is likely one of the few murmur3 libraries that does so).
    twmb committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    14e390c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b58ff99 View commit details
    Browse the repository at this point in the history