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
methods for accessing binary data in Buf objects #3561
Comments
From alex.hartmaier@gmail.comAs discussed on IRC mainly with moritz I'd need a way to get the number of bytes, not elements, of a Buf object so it can be looped and each byte accessed with $buf.[$idx]. |
From @moritzOn Mon Oct 20 06:54:16 2014, abraxxa wrote:
Another use case: cryptography, which typically works on the byte level, even for multi-byte encodings. |
From @skidsOn Mon, 20 Oct 2014 07:01:07 -0700, moritz wrote:
A lot of time has passed and we have has the first part for quite some time. $ perl6 -e '.bytes.say for buf8.new(1,2,3), buf16.new(1,2,3), buf32.new(1,2,3), buf64.new(1,2,3)' ...which is both specced and already tested. Also as a Container type $ perl6 -e '.of.say for Buf[int8].new(1,2,3), Buf[uint16].new(1,2,3), Buf[int32], Buf[uint64]' ...and the native types can be nativesizeof'd $ perl6 -e 'use NativeCall; nativesizeof(.of).say for Buf[int8].new(1,2,3), Buf[uint16].new(1,2,3), Buf[int32], Buf[uint64]' Also there are ways to finagle the second need with NativeCall: $ perl6 -e 'use NativeCall; my $b16 = buf16.new(1,2,3); my $b8 = nativecast(CArray[uint8], $b16); $b8[^6].say' ...though internally this relies on some GC manipulations and the Granted a lot more could be done to make this, and endianness conversions easier, So I'd vote to 'resolve' this ticket, and maybe if the next person who picks |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#123015 (status was 'open')
Searchable as RT123015$
The text was updated successfully, but these errors were encountered: