Check-in [c07658474d]
Overview
SHA1:c07658474d008175c434b4df63ed8c1f041d5b88
Date: 2014-12-28 18:06:19
User: spaskalev
Comment:[mtf] Removed :to indices from copy(..) destinations.
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-12-30
14:03
[7a1684ea05] Added encoding/fibonacci (cc: 100%) (user: spaskalev, tags: trunk)
2014-12-28
18:06
[c07658474d] [mtf] Removed :to indices from copy(..) destinations. (user: spaskalev, tags: trunk)
17:19
[00c4e0e448] Integrate ioutil.ReadByte from the bpe branch into trunk. (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
...
111
112
113
114
115
116
117
118
119
120
121
122
123
		// 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])

				// Restore the value in front and break
				c.table[0] = value
				break
			}
		}
	}
................................................................................
			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])
		c.table[0] = output[i]
	}

	return count, err
}







|







 







|





64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
...
111
112
113
114
115
116
117
118
119
120
121
122
123
		// 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:], c.table[:j])

				// Restore the value in front and break
				c.table[0] = value
				break
			}
		}
	}
................................................................................
			continue
		}

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

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

	return count, err
}