blob: 178b5a7e91147898a325552d1e005975a3c60b08 (
plain) (
tree)
|
|
# Copyright 2022-2023 Gabriel Jensen.
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
.intel_syntax noprefix
.globl zap_abs8
.globl zap_abs01
.globl zap_abs02
.globl zap_abs04
zap_abs8:
mov al,dil
neg al # zap_i8 ret = -inv; // Invert the copy of the input value. This also tests the sign of the value.
cmovs ax,di # if (val < 0x0) ret = val; // If it was positive, just return the unmodified input.
ret # return ret;
zap_abs01:
mov ax,di
neg ax
cmovs ax,di
ret
zap_abs02:
mov eax,edi
neg eax
cmovs eax,edi
ret
zap_abs04:
mov rax,rdi
neg rax
cmovs rax,rdi
ret
|