Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mcbind] [PATCH 4/4] Add a few cases to foldexpr


Allows handling things like

    #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
---
 fold.myr | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fold.myr b/fold.myr
index a94fe0d..03b1589 100644
--- a/fold.myr
+++ b/fold.myr
@@ -36,6 +36,12 @@ const foldexpr = {e
 		match (op, foldexpr(l), foldexpr(r))
 		| (`Oplus, `std.Some `Constint c1,  `std.Some `Constint c2):
 			-> `std.Some `Constint (c1 + c2)
+		| (`Ominus, `std.Some `Constint c1,  `std.Some `Constint c2):
+			-> `std.Some `Constint (c1 - c2)
+		| (`Omul, `std.Some `Constint c1,  `std.Some `Constint c2):
+			-> `std.Some `Constint (c1 * c2)
+		| (`Odiv, `std.Some `Constint c1,  `std.Some `Constint c2):
+			-> `std.Some `Constint (c1 / c2)
 		| (`Oshl, `std.Some `Constint c1,  `std.Some `Constint c2):
 			-> `std.Some `Constint (c1 << c2)
 		| (_, `std.None, _):
@@ -56,6 +62,8 @@ const foldexpr = {e
 			;;
 		;;
 		-> `std.Some `Constblob vals
+	| &(`Esizeof sz):
+		-> `std.Some `Constint (sz : int64)
 	| _:
 		-> `std.None
 	;;
-- 
2.25.1


References:
[mcbind] [PATCH 0/4] Misc mcbind adjustments"S. Gilles" <sgilles@xxxxxxx>