func processWeights(vw alternateHandling, top uint32, wa []colltab.Elem) { ignore := false vtop := int(top) switch vw { case altShifted, altShiftTrimmed: for i := range wa { if p := wa[i].Primary(); p <= vtop && p != 0 { wa[i] = colltab.MakeQuaternary(p) ignore = true } else if p == 0 { if ignore { wa[i] = colltab.Ignore } } else { ignore = false } } case altBlanked: for i := range wa { if p := wa[i].Primary(); p <= vtop && (ignore || p != 0) { wa[i] = colltab.Ignore ignore = true } else { ignore = false } } } }
func convertFromWeights(ws []Weights) []colltab.Elem { out := make([]colltab.Elem, len(ws)) for i, w := range ws { out[i], _ = colltab.MakeElem(w.Primary, w.Secondary, w.Tertiary, 0) if out[i] == colltab.Ignore && w.Quaternary > 0 { out[i] = colltab.MakeQuaternary(w.Quaternary) } } return out }