master
Jordan Orelli 8 years ago
parent 5beddd91a3
commit 59949e2e80

@ -137,7 +137,7 @@ var hlist = nodeList{
panic("not implemented: PushOneLeftDeltaOneRightNonZero") panic("not implemented: PushOneLeftDeltaOneRightNonZero")
}}, }},
lNode{"PopAllButOnePlusOne", 29, 1837, func(r *selectionReader, br bit.Reader) { lNode{"PopAllButOnePlusOne", 29, 1837, func(r *selectionReader, br bit.Reader) {
r.cur.count = 1 r.pop(-1)
r.add(1) r.add(1)
}}, }},
lNode{"PlusThree", 2, 1375, func(r *selectionReader, br bit.Reader) { lNode{"PlusThree", 2, 1375, func(r *selectionReader, br bit.Reader) {
@ -147,7 +147,7 @@ var hlist = nodeList{
panic("not implemented: PlusFour") panic("not implemented: PlusFour")
}}, }},
lNode{"PopAllButOnePlusNPack6Bits", 32, 634, func(r *selectionReader, br bit.Reader) { lNode{"PopAllButOnePlusNPack6Bits", 32, 634, func(r *selectionReader, br bit.Reader) {
r.cur.count = 1 r.pop(-1)
r.add(int(br.ReadBits(6)) + 1) r.add(int(br.ReadBits(6)) + 1)
}}, }},
lNode{"PushOneLeftDeltaNRightZero", 9, 560, func(r *selectionReader, br bit.Reader) { lNode{"PushOneLeftDeltaNRightZero", 9, 560, func(r *selectionReader, br bit.Reader) {
@ -174,7 +174,7 @@ var hlist = nodeList{
panic("not implemented: PushOneLeftDeltaNRightNonZeroPack8Bits") panic("not implemented: PushOneLeftDeltaNRightNonZeroPack8Bits")
}}, }},
lNode{"PopAllButOnePlusN", 30, 149, func(r *selectionReader, br bit.Reader) { lNode{"PopAllButOnePlusN", 30, 149, func(r *selectionReader, br bit.Reader) {
r.cur.count = 1 r.pop(-1)
r.add(int(bit.ReadUBitVarFP(br)) + 1) r.add(int(bit.ReadUBitVarFP(br)) + 1)
}}, }},
lNode{"NonTopoComplexPack4Bits", 38, 99, func(r *selectionReader, br bit.Reader) { lNode{"NonTopoComplexPack4Bits", 38, 99, func(r *selectionReader, br bit.Reader) {
@ -200,7 +200,7 @@ var hlist = nodeList{
r.push(int(bit.ReadUBitVarFP(br))) r.push(int(bit.ReadUBitVarFP(br)))
}}, }},
lNode{"PopOnePlusOne", 27, 2, func(r *selectionReader, br bit.Reader) { lNode{"PopOnePlusOne", 27, 2, func(r *selectionReader, br bit.Reader) {
r.pop() r.pop(1)
r.add(1) r.add(1)
}}, }},
lNode{"PopNAndNonTopographical", 35, 1, func(r *selectionReader, br bit.Reader) { lNode{"PopNAndNonTopographical", 35, 1, func(r *selectionReader, br bit.Reader) {

@ -32,7 +32,6 @@ func (s selection) fill(offset int, displayPath string, dest slotted, br bit.Rea
case *Entity: case *Entity:
Debug.Printf("%s %s (%s)", s, fmt.Sprintf("%s.%s", displayPath, dest.slotName(slot)), dest.slotType(slot)) Debug.Printf("%s %s (%s)", s, fmt.Sprintf("%s.%s", displayPath, dest.slotName(slot)), dest.slotType(slot))
return nil return nil
// Info.Fatalf("%v entity has no decoder for slot %d (%v)", v.Class, slot, v.Class.Fields[slot])
default: default:
Info.Printf("slotted value %v has no decoder for slot %d", dest, slot) Info.Printf("slotted value %v has no decoder for slot %d", dest, slot)
return nil return nil
@ -96,8 +95,15 @@ func (r *selectionReader) push(i int) {
r.cur.count++ r.cur.count++
} }
// pops the last value off of the current selection // pops n elements from the selection. if n is negative, pops all but n
func (r *selectionReader) pop() { r.cur.count-- } // elements from the selection.
func (r *selectionReader) pop(n int) {
if n < 0 {
r.cur.count = -n
} else {
r.cur.count -= n
}
}
// maps a function over the current set of values in the current selection // maps a function over the current set of values in the current selection
func (r *selectionReader) måp(fn func(int) int) { func (r *selectionReader) måp(fn func(int) int) {

Loading…
Cancel
Save