 
 class Primitive extends Type
 	constructor: (@t, @bits, @min, @max) -> super(); @t += @bits
+	create: -> 0
 	bitLength: -> @bits
 	unpackFrom: (r) -> r[@t]()
 	packInto: (w, v) -> w[@t] v


class Scaled extends Type
	constructor: (@type, @min, @max) -> super()
	bitLength: -> @type.bits
	unpackFrom: (r) -> scale @type.unpackFrom(r), @type.min, @type.max, @min, @max
	packInto: (w, v) -> @type.packInto w, scale v, @min, @max, @type.min, @type.max


class Struct extends Type
	constructor: (@members) -> super()
	create: ->
		result = {}
		for [name, type, value] in @members
			result[name] = value ? type.create?()
		result
	bitLength: (v) ->
		s = 0
		for [name, type] in @members
