[mcbind] [PATCH 4/4] Add a few cases to foldexpr
[Thread Prev] | [Thread Next]
- Subject: [mcbind] [PATCH 4/4] Add a few cases to foldexpr
- From: "S. Gilles" <sgilles@xxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Tue, 10 Mar 2020 11:47:51 -0400
- To: "myrddin-dev" <myrddin-dev@xxxxxxxxxxxxxx>
- Cc: "S. Gilles" <sgilles@xxxxxxx>
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
| [mcbind] [PATCH 0/4] Misc mcbind adjustments | "S. Gilles" <sgilles@xxxxxxx> |
- Prev by Date: [mcbind] [PATCH 3/4] Add definition for __inline
- Next by Date: [mcbind] [PATCH 1/4] Allow enum values to be previous members of same enum.
- Previous by thread: [mcbind] [PATCH 3/4] Add definition for __inline
- Next by thread: [mcbind] [PATCH 1/4] Allow enum values to be previous members of same enum.
- Index(es):