@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> anyone know why for a 30 char long string (not including the null) this code returns 30. Shouldnt it return 31?
<0> http://pastebin.com/723659
<1> why would it return 31?
<1> that wouldn't make sense
<0> k, i must be misunderstanding something. Is ecx decremented everytime repne scasb checks a byte?
<2> yes
<1> yeah



<0> so, 0x00 is the 31st byte which is checked by it....so wouldnt ecx also be decremented (for the 31st time)
<1> no because there is termination of the loop (ZF=1)
<0> ah...so the decrement is conditional and occurs after the rep if ZF=0?
<1> well, I'm looking
<1> nah, according to the manual, it is decremented before the check for ZF
<3> i know libraries do a not and a dec to do string length usually
<1> yeah
<3> with the rest being quite similar, though
<3> set ecx to -1 then do the repnz scasb then not ecx and dec it
<3> and you get string length
<0> eh? so if its decremented before the check......wouldnt it decrement also for the null?
<0> tiocsti: yea, i think i've seen that method somewhere before
<3> it took me a while to figure out what it was
<3> like i got the looking for 0 part, but the not had me confused when i first saw it
<3> then i was like...damn those trixy hobbitses
<0> ha
<1> I think it saves you one sub for a not
<1> or something
<3> yeah saves you the mov and the sub
<3> however, i think it serializes you too
<3> performance wise, im not sure, it might be a wash
<3> serializing on the ecx accesses
<1> well, in his code, I don't understand how it could return the true string length
<3> either do i
<1> it should indeed return +1
<3> it should include the \0



<3> from what i can tell
<3> unless his string is 0x40 bytes + a null
<1> 64 is the buffer size
<1> 64 - 63 for a string of length 0
<1> sub 64, 63 = 1
<1> eh.
<1> non sense
<0> the string is 30(decimal) bytes + null
<3> im almost interested enuff to look into that
<3> but eh, not quite
<0> k, i must be ****ing up elsewhere. I copied that code into a test file and it works
<0> time for sleep i reckong
<4> Pu pu pu.
<4> When are we getting a new manager?
<3> we dont need no stinkin manager
<4> We couldn't thange the topic, and it would be catastrophic.
<4> change
<4> http://www.sacred-texts.com/dna/hgp011k.htm the nature is a good coder.
<4> Our body is RISC :_p
<2> it is just the encoding
<5> i use windows xp i use windows xp and im writing a function in ***embler similar to malloc.c but how do i write the ***embler code to set aside 2048 bytes for allocating memory
<5> hello?
<5> hello rembrandt
<5> i use windows xp i use windows xp and im writing a function in ***embler similar to malloc.c but how do i write the ***embler code to set aside 2048 bytes for allocating memory
<6> winapi call?
<6> VirtualAlloc?
<5> yes virtual allocation
<6> it is receipt.
<6> use virtual alloc call.
<6> "virtualAlloc" kernel32.dll


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #asm
or
Go to some related logs:

prozacpimp
#windows
T_OBJECT_OPERATOR+htaccess+php
#linuxhelp
#chatzone
#teens
#linux
Switched Ghosts_In_The_Machine
12WHAT WORLD WAR II COMMANDER HAD THE FORENAME ERWIN?
#mirc



Home  |  disclaimer  |  contact  |  submit quotes