Re: repack ubyte[] to use only 7 bits

2014-12-13 Thread Manolo via Digitalmars-d-learn
On Saturday, 13 December 2014 at 10:09:27 UTC, Charles Hixson via Digitalmars-d-learn wrote: Is there a standard way to do this? The code below is untested, as I haven't yet written the x7to8 routine, and came up with a better way to do what this was to accomplish, but it feels as if this

Re: repack ubyte[] to use only 7 bits

2014-12-13 Thread Manolo via Digitalmars-d-learn
On Saturday, 13 December 2014 at 11:20:21 UTC, Manolo wrote: On Saturday, 13 December 2014 at 10:09:27 UTC, Charles Hixson via Digitalmars-d-learn wrote: Is there a standard way to do this? The code below is untested, as I haven't yet written the x7to8 routine, and came up with a better way

Re: repack ubyte[] to use only 7 bits

2014-12-13 Thread Manolo via Digitalmars-d-learn
On Saturday, 13 December 2014 at 19:52:33 UTC, Charles Hixson via Digitalmars-d-learn wrote: On 12/13/2014 03:20 AM, Manolo via Digitalmars-d-learn wrote: On Saturday, 13 December 2014 at 10:09:27 UTC, Charles Hixson via Digitalmars-d-learn wrote: Is there a standard way to do this? The code

Re: repack ubyte[] to use only 7 bits

2014-12-06 Thread bearophile via Digitalmars-d-learn
Charles Hixson: byte[]x8to7 (ubyte[] bin) Better to add some annotations, like pure, @safe, nothrow, if you can, and to annotate the bin with an in. intfByte, fBit; It's probably better to define them as size_t. switch (fBit) I think D doesn't yet allow this

Re: repack ubyte[] to use only 7 bits

2014-12-06 Thread Charles Hixson via Digitalmars-d-learn
Your comments would be reasonable if this were destined for a library, but I haven't even finished checking it (and probably won't since I've switched to a simple zero elimination scheme). But this is a bit specialized for a library...a library should probably deal with arbitrary ints from 8