summaryrefslogtreecommitdiff
path: root/xgbgen/size.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <[email protected]>2012-04-30 02:40:55 -0400
committerAndrew Gallant (Ocelot) <[email protected]>2012-04-30 02:40:55 -0400
commit91ec0c014823a869775575879de1f5585523fc39 (patch)
treefc768a53ff2bbe0bc2aaee737dd14f3e30bd1d6f /xgbgen/size.go
parentf8f11e1419e4cf86189ccb9964b8235cef90eb4f (diff)
complete and total overhaul like i promised. things are much easier to reason about. still not working yet though.
Diffstat (limited to 'xgbgen/size.go')
-rw-r--r--xgbgen/size.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/xgbgen/size.go b/xgbgen/size.go
new file mode 100644
index 0000000..d00e297
--- /dev/null
+++ b/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)}
+}
+