return 0, errors.New("too big niceness delta")
}
return baseNice - uint8(delta), nil
- } else {
- if delta > 32 || (baseNice == NiceBulk && delta > 31) {
- return 0, errors.New("too big niceness delta")
- }
- return baseNice + uint8(delta), nil
}
+ if delta > 32 || (baseNice == NiceBulk && delta > 31) {
+ return 0, errors.New("too big niceness delta")
+ }
+ return baseNice + uint8(delta), nil
}
func NicenessFmt(nice uint8) string {
}
return strconv.Itoa(int(nice))
}
+
+type ByNice []*SPInfo
+
+func (a ByNice) Len() int {
+ return len(a)
+}
+
+func (a ByNice) Swap(i, j int) {
+ a[i], a[j] = a[j], a[i]
+}
+
+func (a ByNice) Less(i, j int) bool {
+ return a[i].Nice < a[j].Nice
+}