-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path1arg-3factor.template
56 lines (51 loc) · 1.16 KB
/
1arg-3factor.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
%alloc%(HANDLE,
- ((sizeof(TYPE)) * (COUNT) * (STRIDE))
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
%alloc%(HANDLE,
- ((sizeof(THING)) * (COUNT) * (STRIDE))
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
%alloc%(HANDLE,
- ((sizeof(TYPE1)) * (sizeof(TYPE2)) * (COUNT))
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
%alloc%(HANDLE,
- ((sizeof(THING1)) * (sizeof(THING2)) * (COUNT))
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
%alloc%(HANDLE,
- ((sizeof(TYPE1)) * (sizeof(THING2)) * (COUNT))
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@
%alloc%(HANDLE,
- ((COUNT) * (STRIDE) * (SIZE))
+ array3_size(COUNT, STRIDE, SIZE)
, ...)