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     64   		// Loop over the MTF table
    65     65   		for j := byte(1); j != 0; j++ {
    66     66   			if c.table[j] == value {
    67     67   				// Output the value
    68     68   				buffer[index] = j
    69     69   
    70     70   				// Shift the table
    71         -				copy(c.table[1:j+1], c.table[0:j])
           71  +				copy(c.table[1:], c.table[:j])
    72     72   
    73     73   				// Restore the value in front and break
    74     74   				c.table[0] = value
    75     75   				break
    76     76   			}
    77     77   		}
    78     78   	}
................................................................................
   111    111   			continue
   112    112   		}
   113    113   
   114    114   		// Output the value
   115    115   		output[i] = c.table[position]
   116    116   
   117    117   		// Shift the table and restore the value in front
   118         -		copy(c.table[1:position+1], c.table[0:position])
          118  +		copy(c.table[1:], c.table[:position])
   119    119   		c.table[0] = output[i]
   120    120   	}
   121    121   
   122    122   	return count, err
   123    123   }