Questions tagged [x86]
Code which runs on any of the x86 family of instruction set architectures. Questions should also be tagged for the source language (typically [assembly], though others are possible).
86 questions
8
votes
3
answers
881
views
Optimizing Masked Bit Shifts of Gray Code with AND Operation and Parity Count
I am trying to determine the parity of the result of a complex calculation involving two uint64_t variables, value_a and ...
1
vote
1
answer
86
views
An example of a bootloader that changes color in a loop in assembly x86
In short, this bootloader code loads sectors from the disk into memory, sets the video mode and prints a message on the screen. After that, it goes into an infinite loop, keeping the system running.
<...
4
votes
1
answer
182
views
Find minimum element plus index between 8 zmm registers
I want to find the first minimal element and its index of a 64 element long array with the avx512 instuction set. The code works and is in the context of a function that is faster than the equivalent ...
2
votes
1
answer
83
views
Solving the N Queens Puzzle in AEC using stack
N Queens Puzzle is a puzzle which asks you to place N chess queens on an NxN chess board so that no two queens are attacking each other. Two queens are attacking each other if they are on the same row,...
5
votes
1
answer
950
views
Speed up strlen using SWAR in x86-64 assembly
The asm function strlen receives the link to a string as a char - Array. To do so, the function may use SWAR on general purpose register, but without using ...
5
votes
2
answers
127
views
Replace specific characters (CR and LF) in a file
Context
This program has been created to "fix" files originating from Cobol databases. In Cobol, files extracted via something called a "copy" have the same number of characters ...
4
votes
2
answers
305
views
Print decimal integer
This is an x86-64 Linux program to print a non-negative decimal integer. I would appreciate any simple optimizations for size and readability. I am aware that division by a constant is usually done by ...
5
votes
2
answers
218
views
Base64 Encoder in Assembly X86-64
I am a beginner in assembly and would like to know ways I could improve my code. I am talking more about assembly specific things and less the logic e.g. what I could've written better, like loops
<...
2
votes
1
answer
288
views
Multiply two huge base-10 numbers in assembly
This post is a second part of my original post, Add two huge base-10 numbers, which deals with adding two huge base-10 numbers. However, in this case, I'm multiplying two non-negative whole numbers. ...
5
votes
1
answer
194
views
Add two huge base-10 numbers
This is some assembly code I've written to add two base-10 numbers. The input and output are represented as null-terminated ASCII strings, with digits in big-endian order.
I have also provided ...
6
votes
3
answers
1k
views
Space encoder for URL
I’m starting to learn C++ by doing a lot of exercises. I want you to point me to where/what improvements I can do to make my code better.
The exercise:
write a URLencode function that takes a string ...
3
votes
1
answer
282
views
UEFI bootloader
UEFI bootloader.
It reads the file kernel.elf on the disk image, reads through the program headers, copies the LOAD segments into memory, and finally calls ...
2
votes
1
answer
340
views
Hack assembler/disassembler in x86_64 assembly language
Starting from this answer I thought I would show a fully worked example of how to create a data-driven version of the assembler for the Hack assembly language. As I noted in that answer, having ...
4
votes
1
answer
860
views
First assembly program: working with strings and integers
I started learning assembly some days ago and I wrote my first program today. Nothing exceptional here: some user inputs, strings manipulations, integer to string conversion etc... The only purpose ...
4
votes
1
answer
469
views
Assembler made in assembly
I made an assembler for the "hack" assembly language, here's an example of what it looks like:
...