From: jimn8@netcom.com (Jim Nitchals)
To: jimn8@netcom.com
Message Hash: 3f26faea18036fdb9f69b5ea8f6a0d6380a557e78440226c0d93ba0b336a6389
Message ID: <199407101704.KAA13679@netcom14.netcom.com>
Reply To: N/A
UTC Datetime: 1994-07-10 17:04:41 UTC
Raw Date: Sun, 10 Jul 94 10:04:41 PDT
From: jimn8@netcom.com (Jim Nitchals)
Date: Sun, 10 Jul 94 10:04:41 PDT
To: jimn8@netcom.com
Subject: Faster bit count on 680x0
Message-ID: <199407101704.KAA13679@netcom14.netcom.com>
MIME-Version: 1.0
Content-Type: text/plain
A few ways of counting bits without a lookup table were proposed.
Here's a method that should be faster:
; (preamble)
move.w (source)+,d0
clr.w d1
clr.w d2 ; bit count
; body of code that counts bits
repeat 16 ; repeat the following section of code 16 times:
add.w d0,d0 ; shift most significant bit into carry
addx.w d1,d2 ; add zero in d1 plus carry bit to bitcount in d2
rpe ; end of repeated section
The result in d2 is the number of 1 bits in (source). The repeated
section of code is 64 bytes long, well under the cache size of an '020,
so it can be repeatedly executed to count multiple source words without
having to reload the instruction cache.
My duties at Apple have constrained how much I can do for speech
compression at modem rates (a project I want to do for secure phone
applications, Cypherpunk style) but if anyone has some 68K code they'd
like optimized, drop me email. Freeware type efforts preferred-- I
already have a job :)
- Jim Nitchals
QuickTime engineering team
Apple Computer, Inc.
Return to July 1994
Return to “jimn8@netcom.com (Jim Nitchals)”
1994-07-10 (Sun, 10 Jul 94 10:04:41 PDT) - Faster bit count on 680x0 - jimn8@netcom.com (Jim Nitchals)