Check-in [129d90b4a8]
Overview
SHA1:129d90b4a807619a0c54947e655f1ab867d07dcc
Date: 2014-12-26 21:35:59
User: spaskalev
Comment:Added 0dev.org/types, providing aliases that implement sort.Interface for [u]int{8|16|32|64}
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-12-28
17:19
[00c4e0e448] Integrate ioutil.ReadByte from the bpe branch into trunk. (user: spaskalev, tags: trunk)
11:33
[7f9a25c94d] Adding initial pieces of a prototype byte pair encoder (user: spaskalev, tags: bpe)
2014-12-26
21:35
[129d90b4a8] Added 0dev.org/types, providing aliases that implement sort.Interface for [u]int{8|16|32|64} (user: spaskalev, tags: trunk)
16:02
[e72b637df4] Initial implementation of commands/mtf (based on commands/pdc) (user: spaskalev, tags: trunk)
Changes

Added src/0dev.org/types/types.go version [28c92ec651].

            1  +// Package types provides alias types for builtins
            2  +// that implement interfaces such as sort.Interface
            3  +package types
            4  +
            5  +type Unsigned8 []uint8
            6  +
            7  +func (u Unsigned8) Len() int {
            8  +	return len(u)
            9  +}
           10  +
           11  +func (u Unsigned8) Less(i, j int) bool {
           12  +	return u[i] < u[j]
           13  +}
           14  +
           15  +func (u Unsigned8) Swap(i, j int) {
           16  +	u[i], u[j] = u[j], u[i]
           17  +}
           18  +
           19  +type Unsigned16 []uint16
           20  +
           21  +func (u Unsigned16) Len() int {
           22  +	return len(u)
           23  +}
           24  +
           25  +func (u Unsigned16) Less(i, j int) bool {
           26  +	return u[i] < u[j]
           27  +}
           28  +
           29  +func (u Unsigned16) Swap(i, j int) {
           30  +	u[i], u[j] = u[j], u[i]
           31  +}
           32  +
           33  +type Unsigned32 []uint32
           34  +
           35  +func (u Unsigned32) Len() int {
           36  +	return len(u)
           37  +}
           38  +
           39  +func (u Unsigned32) Less(i, j int) bool {
           40  +	return u[i] < u[j]
           41  +}
           42  +
           43  +func (u Unsigned32) Swap(i, j int) {
           44  +	u[i], u[j] = u[j], u[i]
           45  +}
           46  +
           47  +type Unsigned64 []uint64
           48  +
           49  +func (u Unsigned64) Len() int {
           50  +	return len(u)
           51  +}
           52  +
           53  +func (u Unsigned64) Less(i, j int) bool {
           54  +	return u[i] < u[j]
           55  +}
           56  +
           57  +func (u Unsigned64) Swap(i, j int) {
           58  +	u[i], u[j] = u[j], u[i]
           59  +}
           60  +
           61  +type Signed8 []uint8
           62  +
           63  +func (u Signed8) Len() int {
           64  +	return len(u)
           65  +}
           66  +
           67  +func (u Signed8) Less(i, j int) bool {
           68  +	return u[i] < u[j]
           69  +}
           70  +
           71  +func (u Signed8) Swap(i, j int) {
           72  +	u[i], u[j] = u[j], u[i]
           73  +}
           74  +
           75  +type Signed16 []uint16
           76  +
           77  +func (u Signed16) Len() int {
           78  +	return len(u)
           79  +}
           80  +
           81  +func (u Signed16) Less(i, j int) bool {
           82  +	return u[i] < u[j]
           83  +}
           84  +
           85  +func (u Signed16) Swap(i, j int) {
           86  +	u[i], u[j] = u[j], u[i]
           87  +}
           88  +
           89  +type Signed32 []uint32
           90  +
           91  +func (u Signed32) Len() int {
           92  +	return len(u)
           93  +}
           94  +
           95  +func (u Signed32) Less(i, j int) bool {
           96  +	return u[i] < u[j]
           97  +}
           98  +
           99  +func (u Signed32) Swap(i, j int) {
          100  +	u[i], u[j] = u[j], u[i]
          101  +}
          102  +
          103  +type Signed64 []uint64
          104  +
          105  +func (u Signed64) Len() int {
          106  +	return len(u)
          107  +}
          108  +
          109  +func (u Signed64) Less(i, j int) bool {
          110  +	return u[i] < u[j]
          111  +}
          112  +
          113  +func (u Signed64) Swap(i, j int) {
          114  +	u[i], u[j] = u[j], u[i]
          115  +}