aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/size.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/xgbgen/size.go')
-rw-r--r--nexgb/xgbgen/size.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/nexgb/xgbgen/size.go b/nexgb/xgbgen/size.go
new file mode 100644
index 0000000..d00e297
--- /dev/null
+++ b/nexgb/xgbgen/size.go
@@ -0,0 +1,22 @@
+package main
+
+type Size struct {
+ Expression
+}
+
+func newFixedSize(fixed uint) Size {
+ return Size{&Value{v: fixed}}
+}
+
+func newExpressionSize(variable Expression) Size {
+ return Size{variable}
+}
+
+func (s1 Size) Add(s2 Size) Size {
+ return Size{newBinaryOp("+", s1, s2)}
+}
+
+func (s1 Size) Multiply(s2 Size) Size {
+ return Size{newBinaryOp("*", s1, s2)}
+}
+