Skip to content

Commit

Permalink
micro-optimization: use int8 for enums (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
drakkan committed Jul 29, 2022
1 parent 59dc591 commit ea3d820
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion asciiconverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
)

type convertMode int
type convertMode int8

const (
convertModeToCRLF convertMode = iota
Expand Down
6 changes: 3 additions & 3 deletions client_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// HASHAlgo is the enumerable that represents the supported HASH algorithms
type HASHAlgo int
type HASHAlgo int8

// Supported hash algorithms
const (
Expand All @@ -26,7 +26,7 @@ const (
)

// TransferType is the enumerable that represents the supported transfer types
type TransferType int
type TransferType int8

// Supported transfer type
const (
Expand All @@ -35,7 +35,7 @@ const (
)

// DataChannel is the enumerable that represents the data channel (active or passive)
type DataChannel int
type DataChannel int8

// Supported data channel types
const (
Expand Down
4 changes: 2 additions & 2 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ type PortRange struct {
type PublicIPResolver func(ClientContext) (string, error)

// TLSRequirement is the enumerable that represents the supported TLS mode
type TLSRequirement int
type TLSRequirement int8

// TLS modes
const (
Expand All @@ -219,7 +219,7 @@ const (

// DataConnectionRequirement is the enumerable that represents the supported
// protection mode for data channels
type DataConnectionRequirement int
type DataConnectionRequirement int8

// Supported data connection requirements
const (
Expand Down
2 changes: 1 addition & 1 deletion driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/spf13/afero"
)

type tlsVerificationReply int
type tlsVerificationReply int8

const (
// tls certificate is ok but a password is required too
Expand Down

0 comments on commit ea3d820

Please sign in to comment.