|
As the title states, why would one use "movl $1, %eax" as opposed to, say, "movb $1, %eax", I was told that movl would zero out the high order bits of %eax, but isn't %eax a register that's equivalent to the size of the system's wordsize? meaning that...
Started by Negative Acknowledgement on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
To use moving from memory you would be moving....
%eax is a 32-bit register.
You are confusing C every time someone comes out with a new operating system.
EAX will always be a 32-bit value, regardless of the system's register size.
|
|
On 30 Jun 2009 20:48:16 GMT, LiloLilo <danilobrambilla@MUNGED.microcosmotalk.com
Hi all!
while I was looking for a fast way to detect the highest set bit
position into a number, I found this:
* Integer Log base 2 *)
function IntLog2 Value...
Started by LiloLilo on
, 8 posts
by 6 people.
Answer Snippets (Read the full thread at omgili):
I'd think C++....
Was that C or C++? Which compiler?
C compilers usually support inline assembly.
Other than the mention of "BSR EAX,EAX" this is really all C related...
A6e19ea@unlimited.newshosting.com...
|
|
On Sun, 15 Feb 2009 02:23:31 +0100, "Skybuck Flying" <BloodyShame@hotmail.com
Hello,
I have looked at some assembler/instructions when it comes to object
oriented code.
I noticed how the object reference was kept in [eax]. (at least I think that...
Started by Skybuck Flying on
, 13 posts
by 11 people.
Answer Snippets (Read the full thread at omgili):
-- glen
On Sun, 15 Feb 2009 10:33:59 +0000 ankka <jukka@liimatta.org... .
3 for many reasons other than
EAX, but that would add to it.
Look up the method address in the class descriptor.
Is a pointer
to the class descriptor .
|
Ask your Facebook Friends
|
On Mon, 30 Nov 2009 20:59:38 +0000 (UTC), john <john@nospam.com
Hi
I set a breakpoint at Ntdll!NtCreateFile when I open a file from
notepad, and it breaks, however, the instruction displayed is "mov
eax, 25h", i simply don't why, and shouldn't...
Started by john on
, 106 posts
by 28 people.
Answer Snippets (Read the full thread at omgili):
But with a little reflection it is obvious that the value
being written to eax is an argument to the function....
When that wrote
that code.
So I abandoned the apartment
until today.
Has gone
down to 3 degrees F (about -15 C).
|
|
It seems sizeof is not a real function?
for example, if you write like this:
int i=0; printf("%d\n", sizeof(++i)); printf("%d\n", i);
You may get output like:
4 0
And when you dig into the assemble code, you'll find sth like this:
movl $4, %esi leaq LC...
Started by ibread on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
Sizeof_int_vla(3)); }
The size of foo is no longer known at compile-time and has to be determined at run w/ GNU C/++:
#if sizeof(long) < 8 printf("not a 64 bits platform\n"; #else printf("a big system\n.
|
|
Int lcm_old(int a, int b) { int n; for(n=1;;n++) if(n%a == 0 && n%b == 0) return n; } int lcm(int a,int b) { int n = 0; __asm { lstart: inc n; mov eax, n; mov edx, 0; idiv a; mov eax, 0; cmp eax, edx; jne lstart; mov eax, n; mov edx, 0; idiv b; mov eax...
Started by tm1rbrt on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
For example:
28 = 2^2 * 7 312 = 2^3 * 39
so that
lcm(28, 312) = 2^3 * 7 * 39 mov eax, ecx xor edx, edx idiv esi test edx, edx jne lstart mov eax, ecx; idiv edi test edx, edx jnz lstart mov ....
In the factorization of a or b.
|
|
What is the sizeof the union in C/C++? Is it the sizeof the largest datatype inside it? If so, how does the compiler calculate how to move the stack pointer if one of the smaller datatype of the union is active?
Started by Naveen on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Mov %esp,%ebp 0x00001fd5 <main+3>: push %ebx | 0x00001fd5 <main+3>: push %ebx 0x00001fd6(%ebx),%eax | 0x00001fe7 <main+21>: lea 0x1d(%ebx),%eax 0x00001fed <main+27>: mov %eax,(%esp) | 0x000....
|
|
For very low level optimization purposes it would be useful to me if I could store a compiled function inside a variable directly, not a pointer to a function. That is, if I have a function foo, I want to make a char buffer large enough to hold the machine...
Started by Joseph Garvin on
, 13 posts
by 13 people.
Answer Snippets (Read the full thread at stackoverflow):
It by making multiply always return 26 code[0] = 0xB8; // mov eax, 1Ah code[1] = 0x1A; code[2] = 0x00; code[3 = foo(i); break; case 'b': j = bar(i); break; case 'c': j = baz(i); break; default: j = 0; } printf,%esp 8048491: a1 1c....
|
|
We are looking to migrate a performance critical application to .Net and find that the c# version is 30% to 100% slower than the Win32/C depending on the processor (difference more marked on mobile T7200 processor). I have a very simple sample of code...
Started by Steve on
, 9 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Also you have to expect at least a little bit to a mixed language solution, using your already-debugged C code for the high performance sections.
Sure the optimization for C is different than C#.
|
|
Compiling this simple function with MSVC2008, in Debug mode:
int __cdecl sum(int a, int b) { return a + b; }
I get the following disassembly listing:
int __cdecl sum(int a, int b) { 004113B0 push ebp 004113B1 mov ebp,esp 004113B3 sub esp,0C0h 004113B9...
Started by Eli Bendersky on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
That can be catched by the debugger, so you can fix your code .
You will end up in a field of "int 3" opcodes:
int 3 ; 0xCC int 3 ; 0xCC int 3 ; 0xCC int 3 ; 0xCC int 3 ; 0xCC int 3 ; 0xCC ...
|