On Thu, 28 Jan 2016 11:49:09 -0800 (PST), Scotty C <costo...@hotmail.com> wrote:
>what's been bothering me was trying to get the data into 16 bytes in >a byte string of that length. i couldn't get that to work so gave up and >just shoved the data into 25 bytes. here's a bit of code. i think it's >faster than my bignum stuff. > >(define p (bytes 16 5 1 12 6 24 17 9 2 22 4 10 13 18 19 20 0 23 7 > 21 15 11 8 3 14)) >(define (c1 p) ;move blank left > (let( > (x (bytes-ref p 15)) > (c (bytes-copy p))) > (bytes-set! c 15 0) > (bytes-set! c 16 x) > (bytes=? p c) > c)) I don't doubt that it's faster. I'd bet that it will be faster even for larger sizes. It also has the advantage of being able to encode enormous 255x255 puzzles. However, memory space rears its ugly head again. The allocation for a 25 byte string is on par with my estimate of the minimum allocation for a bignum. Packing the bits tight likely may save you ~16 bytes per entry. I stress _may_ because the allocator details are unknown to me. Use (current-memory-use) to figure it out. George -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.