Optimizing multiple conditionals? (specifically modern CPUs)
Moderator: Moderators
Re: Optimizing multiple conditionals? (specifically modern C
POWER9 was released 2017 and POWER10 is coming next year. Someone forgot to tell it it's dead
Re: Optimizing multiple conditionals? (specifically modern C
Is "defunct in devices intended for home and small business use" more honest?
Re: Optimizing multiple conditionals? (specifically modern C
My Blackbird begs to differ.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Optimizing multiple conditionals? (specifically modern C
I finally found (or made, rather) a way to find the size of an argument in NASM:
It's pretty ugly though... I didn't implement segment registers, but I really don't see that being a problem. However, it only works with lowercase; I don't know if there is some existing functionality to convert to uppercase or lowercase, but if there isn't, I can easily make a solution.
Does anyone know if there is a good website for posting code like this? (I'm not counting github; I think that's more geared toward projects and not code snippets, and it isn't x86 assembly oriented) I figure this could be useful for other assembly programmers. If not, as I now know, web hosting is cheap, lol.
Code: Select all
%macro find_argument_size 1
%defstr argument %1
%substr test argument 1,4
%if test == 'byte'
%define size 'byte'
%elif test == 'word'
%define size 'word'
%else
%substr test argument 1,5
%if test == 'dword'
%define size 'dword'
%elif test == 'qword'
%define size 'qword'
%else
%substr test argument 1,2
%if test == 'si' || test == 'di' || test == 'bp' || test == 'sp'
%substr test argument 3,1
%if test == 'l'
%define size 'byte'
%else
%define size 'word'
%endif
%else
%substr test argument 1,1
%if test == 'a' || test == 'b' || test == 'c' || test == 'd'
%substr test argument 2,1
%if test == 'x'
%define size 'word'
%else
%define size 'byte'
%endif
%elif test == 'e'
%define size 'dword'
%elif test == 'r'
%substr test argument 3,1
%if test == 'b'
%define size 'byte'
%elif test == 'w'
%define size 'word'
%elif test == 'd'
%define size 'dword'
%else
%substr test argument 4,1
%if test == 'b'
%define size 'byte'
%elif test == 'w'
%define size 'word'
%elif test == 'd'
%define size 'dword'
%else
%define size 'qword'
%endif
%endif
%endif
%endif
%endif
%endif
%endmacro
Does anyone know if there is a good website for posting code like this? (I'm not counting github; I think that's more geared toward projects and not code snippets, and it isn't x86 assembly oriented) I figure this could be useful for other assembly programmers. If not, as I now know, web hosting is cheap, lol.
Re: Optimizing multiple conditionals? (specifically modern C
GitHub has a "Gist" service for single-file repositories.