Re: Other information and dates of an archive

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

CChris wrote:
> 
> And no, Eu doesn't have a peek2() routine. What you did is correct.
> You could make it faster by combining two 2-byte reads into one 4-byte read
> 
> using peek4u though:
> }}}
<eucode>
> atom temp
> temp=peek4u(system_create_time)
> year = remainder(temp,65536)
> month= floor(temp/65536)
> </eucode>
{{{


If you get rid of remainder() it would be even faster:
atom temp, year, month, t
temp = 2007 + #10000 * 2

constant reps = 10000000

? reps

t = time()
for i = 1 to reps do
	year = remainder(temp,#10000)
	month= floor(temp/#10000)
end for
? time() - t
? year
? month

t = time()
for i = 1 to reps do
	year = and_bits( temp, #FFFF )
	month = floor( temp / #10000 )
end for
? time() - t
? year
? month

? getc(0)

It's almost twice as fast to use and_bits() instead of remainder() on my 
machine.  Also, bitwise stuff if usually easier to see what's going on 
if you use hexadecimal IMHO.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu