While testing things around Compiler Explorer, I tried out the following overflow-free function for calculating the average of 2 unsigned 32-bit integers: uint3
I am trying to build a pintool that should be able to instrument an open() syscall that targets a specific file/directory and replace the file path argument wit
I recently been trying to execute system commands using pure assembly. I managed to achieve it in a x32 bit binary as posted here: execute system command (bash)
I have following piece of code: typedef struct { int x; int y; int z; int w; } s32x4; s32x4 f() { s32x4 v; v.x
In a separate C program, I have passed 4 parameters to an x86 ASM program. dividend divisor Quotient pointer Remainder pointer dividend = 0xA divisor = 0x3 Whic
Here is a simple function #include <stdio.h> int foo() { int a = 3; int b = 4; int c = 5; return a * b * c; } int main() { int a = f
Where I can find info on AMD Ryzen CPUs and how they expect MSI address/data to be programmed? The Intel manual is crystal clear in its description (pictured be
(This question refers specifically to x86/x86_64) I'm working on an application that needs to insert a small block of instructions at specific points within ano
I am trying to use the write syscall in order to reproduce the putchar function behavior which prints a single character. My code is as follows, asm_putchar:
I'm trying to work with arrays in GNU assembly. In my opinion the following code must exit with value 3. But it exits with 13. .section __DATA,__data inArr:
Is there a fast way to take 2.0 to some floating-point degree x? I mean something faster than pow(2.0, x) and preferrably what vectorizes well with AVX2. The c
I have a working C program that has the simple function that returns a d character encoded in a byte array. char foo() { return 'd'; } char byte_array[] = {0
I have a working C program that has the simple function that returns a d character encoded in a byte array. char foo() { return 'd'; } char byte_array[] = {0
I received a task in college to compare execution time for calculating SHA256 in C# and assembly. It is supposed to be a simple WPF app with file input and 2 bu
Background: I have been learning x86_64 assembly using NASM on a Linux system and was writing a subroutine for strlen(const char *str) I wanted to copy one byte
This question is about terminology for 32-bit vs. 64-bit x86. If I have 2 directories with source code of the same program - one for 32-bit Windows and another
According to Intel in x64 the following registers are called general purpose registers (RAX, RBX, RCX, RDX, RBP, RSI, RDI, RSP and R8-R15) https://software.inte
I have an m1 mac and I am trying to run a amd64 based docker image on my arm64 based host platform. However, when I try to do so (with docker run) I get the fol
I was studying the x86_64 assembly for the following function: /// Returns the greatest power of two less than or equal to `self`, or 0 otherwise. pub const fn
I am trying to create a executable file works on Windows 64bit from linux. I am using MXE to cross compile c file on my ubuntu server. And after I compile c fil