One improvement especially if you don't need the full unpacked byte results:

   ts '1 2 4 8 16 32 64 128 (17 b.)"0 1 a'
0.0612363 6.71123e7

   ts '12 32 128 (17 b.)"0 1 a'
0.0217824 3.35572e7

   ts '12 (17 b.) a'
0.00643105 8.39066e6


----- Original Message -----
From: Pascal Jasmin <[email protected]>
To: "[email protected]" <[email protected]>
Cc: 
Sent: Wednesday, September 11, 2013 9:56:20 PM
Subject: [Jprogramming] bit fields

I noticed that there is no special code for any of the following: (J7-64)

   a =. ? 1e6 # 256
   ts '2 2 2 2 2 2 2 2 #: a'

0.124369 6.71107e7
   ts '4 2 4 2 4 2 #: a'
0.0943141 6.71105e7
   a2 =.? 1e6 # 256^2
   ts '8 8 4 2 4 2 4 2 #: a2'
0.144685 6.71107e7
   a3 =.? 1e6 # 1-~256^4
   a2 =.? 1e6 # 1-~256^2
   ts '8 8 4 2 4 2 4 2 #: a2'
0.141351 6.71107e7
   ts '256 256 8 8 4 2 4 2 4 2 #: a3'
0.247149 1.3422e8

   ts '512 512 128 128 #: a3'
0.0837122 3.35561e7
   ts '256 256 256 256 #: a3'
0.0805493 3.35561e7

Is there a way to do bit unpacking more efficiently (space wise)?  I notice the 
huffman encoding lab is faster and smaller even though it seems to be doing 
much more work.

 t=: 'the quick brown fox jumps over the lazy dog '

 x=: 1e6 $ t

 
   ts 'HA hencode x'
0.0267345 1.67822e7
   ts 'SB hdecode y'
0.0491284 1.78308e7
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to