flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4 |
Author |
|
Madis731 31 Mar 2009, 10:13
A long thread, but I thought I would through my 2 cents in.
1) If the null termination was a no-problem, then this thread wouldn't be so long ![]() 2) Null termination is O(n) to scan, but knowing the length beforehand is just a lookup O(1). 3) Why would anyone need a better string library if the original one "isn't that bad"? http://bstring.sourceforge.net/ 4) When I see that one goes to great lengths to optimize null-byte search, then is must be slow: Code: #define has_nullbyte_(x) ((x - 0x01010101) & ~x & 0x80808080) ; OR the same in ASM: mov edx, eax ;eax is the X from the C-style code not eax sub edx, 0x01010101 and eax, 0x80808080 and eax, edx |
|||
![]() |
|
LocoDelAssembly 31 Mar 2009, 20:02
Because you have found a bug in the macro.
The way you should do that is this: Code: stdcall [send], [g_hSock], addr edi+4, dword[edi], 0 ; OR ; invoke send, [g_hSock], addr edi+4, dword[edi], 0 Your code, instead of generating an error was generating the following code Code: PUSH 0 PUSH DWORD [EDI] ; The next two pushes was generated by "edi+4" PUSH EDI PUSH 4 PUSH DWORD [g_hSock] CALL DWORD [send] |
|||
![]() |
|
Azu 31 Mar 2009, 20:15
Thanks.. I added the "addr".. but now it won't compile x_x
|
|||
![]() |
|
LocoDelAssembly 31 Mar 2009, 20:55
Ah, are you using win32{a|w}x.inc?
The "addr" will do nothing more than "lea edx, [parameter]/push edx" (so take care if you send EDX as parameter before any addr). Take a look at http://flatassembler.net/docs.php?article=win32 (If hurried go straight to "2. Extended headers") |
|||
![]() |
|
Azu 01 Apr 2009, 04:37
Working fine now. Thanks.
![]() |
|||
![]() |
|
Madis731 01 Apr 2009, 09:01
Code: ;xmm0 is loaded with 16 bytes of comparable string pxor xmm1,xmm1 pcmpeqb xmm0,xmm1 pmovmskb eax,xmm0 ;eax = will show a bit for each byte position ; 0 means that no nullbyte found |
|||
![]() |
|
Goto page Previous 1, 2, 3, 4 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.