aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/size.go
blob: 70edb8fbaeb9e425a4186f0ad97e13c9b23ed833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)}
}