Today I came across this question:
you have a code
static int counter = 0;
void worker() {
for (int i = 1; i <= 10; i++)
counter++;
}
If worker would be called from two different threads, what value will counter have after both of them are finished?
I know that actually it could be anything. But my internal guts tells me...
I'm using Delphi to make an XLL add-in for Excel, which involves making a lot of calls to the Excel4v function of xlcall32.dll. However, as I'm guessing very few Delphi experts here have worked with that specific API, I'm hoping that the problem might have been observed in other APIs too.
In C, specifically in the xlcall.h file that co...
Below is a clip from a listing of two Pentium assembly sequences. We have an outside loop that is trying to time our sequences and is doing a call-through-table to get to these routines. Therefore, the outside call is being made from the same location every time. The two sequences differ in that the first one has one less instruction tha...
Hi
how can I write just a simple disassembler for linux from scratches?
Are there any libs to use? I need something that "just works".
thank in advanced
...
it's assembler right? can someone please point out the progression that we've had in programming languages since assembler to the days of asp.net, namely the chronological order of languages?
...
I am writing a Tiger compiler in F# and I have decided to emit x86 assembly. I know the basics of how a machine is constructed and also a bit of assembly, but not enough to write a good compiler back-end.
What resources can you recommend for learning what I need to know?
Where can I look up information such as calling conventions, etc....
what is the assembler syntax to see which of two numbers is greater? what is the lower level (machine code) for it? can we go even lower? once we get to the bit level, what happens? how is it represented in 0's and 1's?
...
Is it possible to compare whole memory regions in a single processor cycle? More precisely is it possible to compare two strings in one processor cycle using some sort of MMX assembler instruction? Or is strcmp-implementation already based on that optimization?
EDIT:
Or is it possible to instruct c++ compiler to remove string duplicates...
I previously asked a question on here, but I was unregistered and wasn't able to edit my entry (not sure if you can) or add any information about the issue. I'm going to attempt to be more thorough this time so I can hopefully get an answer...
I'm trying to find a static pointer and a list of offsets so that I can easily find informati...
Possible Duplicate:
How can I multiply two 64bit numbers using x86 assembly language?
How do you multiply two 64-bit numbers in x86 assembler?
This question is important for historical reasons.
Presumably, Joel meant 386 assembler.
Related question
How do you multiply two 64bit numbers in assembly
...
If this Question duplicates I'm sorry but I think I did it the wrong way the 1st time. Well I have sum assembly homework to do... its supposed to be the snake game. I managed to make a program using parts of others ones, since Im lazy.. anyhow I got the program almost ready but I get only 1 error when assembling:
**Fatal** C:\TASM\emu8...
There're two well-known ways to set an integer register to zero value on x86.
Either
mov reg, 0
or
xor reg, reg
There's an opinion that the second variant is better since the value 0 is not stored in the code and that saves several bytes of produced machine code. This is definitely good - less instruction cache is used and this ca...
I'm having a hard time beating my compiler using inline assembly.
What's a good, non-contrived examples of a function which the compiler has a hard time making really, really fast and simple? But that's relatively simple to make with inline assembly.
...
hi I have disassembled some programs (linux) I wrote to understand better how it works, and I noticed that the main function always begins with:
lea ecx,[esp+0x4] ; I assume this is for getting the adress of the first argument of the main...why ?
and esp,0xfffffff0 ; ??? is the compiler trying to align the stack pointer on 16 byte...
Hello all,
I'm quiet familiar with gcc assembly... Recently I was forced to turn back to g++ for some codes clean up. Let me mention I'm too much familiar with assembly, hence, for some curiosity purposes, I often get a look at how good the compiler generated asm is.
But the naming conventions with g++ are just bizaare. I was wondering...
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 instructions generated for foo, and then be able to in effect call foo by somehow ...
I'd like to play with writing some assembly on my Mac, ideally native, but I'd understand if it's easier to learn in QEMU or something.
I see that there are different dialects of assembly depending on the processor - what dialect is the "best" to learn?
I don't really have any idea of where to start, any pointers as to how to even run ...
Hello all,
I am writing an application in C in GCC (for linux/ubuntu) that uses the following inline assembly:
float a[4] = { 10, 20, 30, 40 };
float b[4] = { 0.1, 0.1, 0.1, 0.1 };
asm volatile("movups (%0), %%xmm0\n\t"
"mulps (%1), %%xmm0\n\t"
"movups %%xmm0, (%1)"
:: "r" (a), "r" (b));
Excuse...
I'm doing some work involving MIPS assembly, and I keep coming across these four floating-point load/store pseudoinstructions: l.s, l.d, s.s, s.d. I found some documentation online and figured out that there are four "actual" instructions that seem to do the same thing: lwc1, ldc1, swc1, and sdc1.
My only question is, what's the differe...
I'm hoping to learn assembly language for x86. I'm on a Mac, and I'm assuming most x86 tutorials/books use code that's meant for Windows.
How does the OS that code is run on affect what the code does, or determine whether the code even works? Could I follow a Windows-based tutorial, and modify a few commands to make it work for Mac wi...