I think I'm tired... I'm writing weird code. Believe me or not, but if you feed 
powers of ten to this strange thing, it divides them by 10:


var bit testbit_0 at digit_divisor:0
var bit testbit_1 at digit_divisor:1
var bit testbit_2 at digit_divisor:2
var bit testbit_3 at digit_divisor:3
var bit testbit_4 at digit_divisor:4
var bit testbit_5 at digit_divisor:5
var bit testbit_6 at digit_divisor:6
var bit testbit_7 at digit_divisor:7
var bit testbit_8 at digit_divisor:8
var bit testbit_9 at digit_divisor:9

if     testbit_0    then digit_divisor=0        
elsif  testbit_1    then digit_divisor=1        
elsif  testbit_2    then digit_divisor=10       
elsif  testbit_3    then digit_divisor=100      
elsif  testbit_4    then digit_divisor=1000     
elsif  testbit_5    then digit_divisor=10000    
elsif  testbit_6    then digit_divisor=100000   
elsif  testbit_7    then digit_divisor=1000000  
elsif  testbit_8    then digit_divisor=10000000 
elsif  testbit_9    then digit_divisor=100000000
end if
 
Compared to the case construct below, it saves about 200 words of code, and it 
runs a little faster, so the average is then 19065.

Greets,
Kiste

> I've sped up the conversion in your version before the last
> to an average of 19365 by taking out the division by 10:
> 
> case digit_divisor of   -- funny replacement
> of  digit_divisor / 10
>               1:
> digit_divisor=0
>              10:
> digit_divisor=1
>             100:
> digit_divisor=10
>           1_000:
> digit_divisor=100
>          10_000:
> digit_divisor=1_000
>         100_000: digit_divisor=10_000
>       1_000_000: digit_divisor=100_000
>      10_000_000:
> digit_divisor=1_000_000
>     100_000_000: digit_divisor=10_000_000
>   1_000_000_000: digit_divisor=100_000_000
> end case
> 
> but this little case statement eats more than 200 words of
> code!
> 



-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to