-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[CRC32c] Support AbstractVector{UInt8} as input #56164
base: master
Are you sure you want to change the base?
Conversation
@@ -51,6 +51,5 @@ mixed with a starting `crc` integer. If `nb` is not supplied, then | |||
""" | |||
crc32c(io::IO, nb::Integer, crc::UInt32=0x00000000) = Base._crc32c(io, nb, crc) | |||
crc32c(io::IO, crc::UInt32=0x00000000) = Base._crc32c(io, crc) | |||
crc32c(io::IOStream, crc::UInt32=0x00000000) = Base._crc32c(io, crc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is redundant with the method above.
@@ -30,13 +29,14 @@ calling [`take!`](@ref). | |||
|
|||
For a `String`, note that the result is specific to the UTF-8 encoding | |||
(a different checksum would be obtained from a different Unicode encoding). | |||
To checksum an `a::Array` of some other bitstype, you can do `crc32c(reinterpret(UInt8,a))`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work if a
has padding or is multidimensional. I updated the docstring to note that a
must not have padding, and that vec
should be used in addition to reinterpret(UInt8
.
Co-authored-by: Steven G. Johnson <[email protected]>
This is a similar PR to JuliaIO/CRC32.jl#12
I added a generic fallback method for
AbstractVector{UInt8}
similar to the existing genericIO
method.