00:00:00 --- log: started forth/09.08.14 00:06:04 --- join: gogonkt (n=info@59.38.223.69) joined #forth 02:13:35 --- quit: proteusguy ("Leaving") 02:49:36 --- join: gogonkt_ (n=info@59.38.200.108) joined #forth 03:02:25 --- quit: gogonkt (Read error: 110 (Connection timed out)) 03:05:03 --- join: GeDaMo (n=gedamo@212.225.115.96) joined #forth 04:28:32 --- quit: nighty__ ("Disappears in a puff of smoke") 04:52:00 --- quit: GeDaMo ("Leaving.") 05:16:39 --- quit: gogonkt_ (Read error: 110 (Connection timed out)) 05:19:34 --- join: gogonkt (n=info@59.38.200.108) joined #forth 05:54:37 --- join: xjrn (n=jim@astound-69-42-10-25.ca.astound.net) joined #forth 07:14:48 * madgarden is back (gone 07:36:44) 08:23:14 --- join: GeDaMo (n=gedamo@212.225.115.96) joined #forth 08:23:40 Hi GeDaMo :-) 08:23:47 Hi impomatic :) 08:55:56 : c >r 256 15 16 1799 4 13107 2 21845 r> 4 0 do tuck over and -rot invert and rot / + loop ; 08:59:00 Ok, I give up - what does that do? :P 09:03:16 puts nasty stuff on the return stack? 09:03:41 which doesn't seem to be used in the do loop. 09:04:06 doh. braino 09:04:29 ( u1 -- u2 ) ( R: -- ) 09:05:57 4 iterations on the loop, 8 values 09:06:41 instead of tuck over couldn't you just do 2dup? 09:07:17 Hmmm .... no 09:07:33 No, it'd be swap 2dup 09:07:58 2dup and swap invert and 09:09:34 Ignore me, just thinking aloud :P 09:10:45 Give us an example of an input value 09:11:07 u1 = 0 to 65535 09:14:50 Counting bits :) 09:15:00 Nice work GeDaMo. 09:15:09 : countbits 0 i 16 0 do 2 /mod -rot + swap loop drop ; 09:15:35 Did you try with a lookup table? 09:15:46 That would be much clearer, but takes twice as long. 09:15:57 Lookup table? No. 09:16:13 http://gurmeetsingh.wordpress.com/2008/08/05/fast-bit-counting-routines/ 09:19:34 Interesting. My first code is 5 - nifty parallel count. The nice clean I just posted is 1 - iterated count. 09:20:25 At the bottom of the article, it compares times 09:20:54 --- quit: gogonkt ("leaving") 09:21:15 --- join: gogonkt (n=info@59.38.200.108) joined #forth 09:21:58 --- quit: gogonkt (Client Quit) 09:22:09 --- join: gogonkt (n=info@59.38.200.108) joined #forth 09:23:40 The first one executes half as many words as the second. If they're extended for 32 bits, the first will execute 1/4 as many. 09:23:50 I don't think I can simplify the code any more. 09:23:50 It's ugly and will always be ugly. I can't do much to make it easier to understand apart from add a few comments. 09:25:08 Using a lookup table will be clearer and faster 09:27:28 The MIT HAKMEM algorithm looks interesting 09:30:35 I know the clever bit fiddling tricks are attractive but they're not always the best solution :P 09:34:23 It's always so easy to overly-clever yourself into a headache ;) 09:35:42 --- nick: madwork_ -> madwork 09:53:55 --- quit: hh1000 ("Leaving") 09:55:27 That MIT code is giving me a headache :-( 10:04:02 Okay, I figured it. The magic number are in octal, not hex. 10:10:31 I think this is the shortest : countbits dup 2/ dup 2/ 4681 and swap 14043 and + - dup 8 / + 29127 and 63 mod ; 10:11:57 : countbits dup 8 >> 255 and bits-table + c@ swap 255 and bits-table + c@ + ; 10:22:43 I've obviously been contaminated by C - '>>' should be rshift :P 10:46:48 --- join: aguai (n=aguai@98.142.211.123) joined #forth 11:09:53 --- join: pgas (n=user@pdpc/supporter/active/pgas) joined #forth 12:07:46 --- join: Maki (n=Maki@dynamic-78-30-139-176.adsl.eunet.rs) joined #forth 12:42:53 --- quit: mathrick (wolfe.freenode.net irc.freenode.net) 12:42:54 --- quit: maht (wolfe.freenode.net irc.freenode.net) 12:56:05 --- join: mathrick (n=mathrick@users177.kollegienet.dk) joined #forth 12:56:22 --- join: maht (n=maht__@85-189-31-174.proweb.managedbroadband.co.uk) joined #forth 12:58:44 --- join: segher (n=rehges@84-105-60-153.cable.quicknet.nl) joined #forth 14:01:51 --- quit: tgunr (Read error: 110 (Connection timed out)) 14:16:26 --- quit: Maki ("Leaving") 14:50:09 --- join: Quartus` (n=Quartus`@74.198.12.4) joined #forth 15:06:28 --- quit: GeDaMo ("Leaving.") 15:46:43 --- quit: pgas ("/quit") 16:46:47 --- join: davec (n=tgunr@polymicro.net) joined #forth 17:00:51 --- quit: davec () 18:08:37 --- quit: Quartus` (Read error: 110 (Connection timed out)) 18:49:44 --- join: davec (n=tgunr@polymicro.net) joined #forth 18:56:00 --- nick: davec -> tgunr 20:09:30 slava! You're king of the mountain! 20:42:58 --- join: nighty__ (n=nighty@x122091.ppp.asahi-net.or.jp) joined #forth 21:48:26 --- quit: nighty__ (Remote closed the connection) 22:23:07 --- quit: impomatic ("mov.i #1,1") 22:30:46 --- quit: xjrn (Read error: 110 (Connection timed out)) 22:54:37 --- join: xjrn (n=jim@astound-69-42-10-25.ca.astound.net) joined #forth 23:35:51 --- quit: xjrn (Read error: 110 (Connection timed out)) 23:59:59 --- log: ended forth/09.08.14