Re: Faster lower() command

new topic     » goto parent     » topic index » view thread      » older message » newer message

jacques deschĂȘnes wrote:
> 
> I'm using windows xp pro running on DELL inpiron 1501 with 1Go Ram
> CPU AMD turion 64x2 1.60Ghz
> 
> Why euphoria interpreter should create 5 or 6 * 1000000 long sequence?
> each character is represented by an integer so its a 4000000 bytes array

let x be "ABC"
and our expression is:
  x = x + ((x >= 'A') and (x <= 'Z')) * 32

Break down the expression into simplest terms..

tmp1 = (x >= 'A')      -- {1,1,1} = ({65,66,67} >= 65)
tmp2 = (x <= 'Z')      -- {1,1,1} = ({65,66,67} <= 90)
tmp1 = (tmp1 and tmp2) -- {1,1,1} = ({1,1,1} and {1,1,1})
tmp1 = tmp1 * 32       -- {32,32,32} = {1,1,1} * 32
x = x + tmp1           -- {97,98,99} = {65,66,67} + {32,32,32}

2 tmp sequences would be required.

Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~
http://empire.iwireweb.com - Empire for Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu