Add a helper function to get the sign bit.

This commit is contained in:
Stephen Heumann 2021-03-09 00:24:26 -06:00
parent 98cfd4e831
commit 9e727697d3
1 changed files with 25 additions and 0 deletions

View File

@ -128,3 +128,28 @@ lb1 sta val
creturn 2:val
end
****************************************************************
*
* int __signbit(long double x);
*
* Get the sign bit of a floating-point value
*
* Inputs:
* val - the number
*
* Outputs:
* 0 if positive, non-zero if negative
*
****************************************************************
*
__signbit start
csubroutine (10:val),0
lda val+8
and #$8000
sta val
creturn 2:val
end