Check-in [c07658474d]
Overview
Comment:[mtf] Removed :to indices from copy(..) destinations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c07658474d008175c434b4df63ed8c1f041d5b88
User & Date: spaskalev on 2014-12-28 18:06:19
Other Links: manifest | tags
Context
2014-12-30
14:03
Added encoding/fibonacci (cc: 100%) check-in: 7a1684ea05 user: spaskalev tags: trunk
2014-12-28
18:06
[mtf] Removed :to indices from copy(..) destinations. check-in: c07658474d user: spaskalev tags: trunk
17:19
Integrate ioutil.ReadByte from the bpe branch into trunk. check-in: 00c4e0e448 user: spaskalev tags: trunk
Changes

Modified src/0dev.org/mtf/mtf.go from [4488b5a476] to [f2ad12a795].

64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78







-
+







		// Loop over the MTF table
		for j := byte(1); j != 0; j++ {
			if c.table[j] == value {
				// Output the value
				buffer[index] = j

				// Shift the table
				copy(c.table[1:j+1], c.table[0:j])
				copy(c.table[1:], c.table[:j])

				// Restore the value in front and break
				c.table[0] = value
				break
			}
		}
	}
111
112
113
114
115
116
117
118

119
120
121
122
123
111
112
113
114
115
116
117

118
119
120
121
122
123







-
+





			continue
		}

		// Output the value
		output[i] = c.table[position]

		// Shift the table and restore the value in front
		copy(c.table[1:position+1], c.table[0:position])
		copy(c.table[1:], c.table[:position])
		c.table[0] = output[i]
	}

	return count, err
}