shithub: femtolisp

Download patch

ref: 184211fc26dcf3b7916d8210588ee1844606fa18
parent: 49d1461e441aea2ebb5bd237bad1026723582b85
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Nov 19 04:46:28 EST 2024

mpint: rearrange fields and use int for flags - slightly faster

--- a/3rd/mp/mpaux.c
+++ b/3rd/mp/mpaux.c
@@ -3,8 +3,8 @@
 static mpdigit _mptwodata[1] = { 2 };
 static mpint _mptwo =
 {
-	1, 1, 1,
 	_mptwodata,
+	1, 1, 1,
 	MPstatic|MPnorm
 };
 mpint *mptwo = &_mptwo;
@@ -12,8 +12,8 @@
 static mpdigit _mponedata[1] = { 1 };
 static mpint _mpone =
 {
-	1, 1, 1,
 	_mponedata,
+	1, 1, 1,
 	MPstatic|MPnorm
 };
 mpint *mpone = &_mpone;
@@ -21,8 +21,8 @@
 static mpdigit _mpzerodata[1] = { 0 };
 static mpint _mpzero =
 {
-	1, 1, 0,
 	_mpzerodata,
+	1, 0, 1,
 	MPstatic|MPnorm
 };
 mpint *mpzero = &_mpzero;
--- a/posix/mp.h
+++ b/posix/mp.h
@@ -38,11 +38,11 @@
 
 struct mpint
 {
-	int	sign;	/* +1 or -1 */
+	mpdigit	*p;
 	uint32_t	size;	/* allocated digits */
 	uint32_t	top;	/* significant digits */
-	mpdigit	*p;
-	char	flags;
+	int	sign;	/* +1 or -1 */
+	int	flags;
 };
 
 enum