mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: fix misuses of "a" vs "an"
Fixes the misuse of "a" vs "an", according to English grammatical expectations and using https://www.a-or-an.com/ Change-Id: I53ac724070e3ff3d33c304483fe72c023c7cda47 Reviewed-on: https://go-review.googlesource.com/c/go/+/480536 Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
f62c9701b4
commit
d8d22664c6
31 changed files with 41 additions and 41 deletions
|
|
@ -67,7 +67,7 @@ const (
|
||||||
//
|
//
|
||||||
// IDs 0..31 are reserved for official use by PKWARE.
|
// IDs 0..31 are reserved for official use by PKWARE.
|
||||||
// IDs above that range are defined by third-party vendors.
|
// IDs above that range are defined by third-party vendors.
|
||||||
// Since ZIP lacked high precision timestamps (nor a official specification
|
// Since ZIP lacked high precision timestamps (nor an official specification
|
||||||
// of the timezone used for the date fields), many competing extra fields
|
// of the timezone used for the date fields), many competing extra fields
|
||||||
// have been invented. Pervasive use effectively makes them "official".
|
// have been invented. Pervasive use effectively makes them "official".
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ func (b *Buffer) Reset() {
|
||||||
b.lastRead = opInvalid
|
b.lastRead = opInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
// tryGrowByReslice is a inlineable version of grow for the fast-case where the
|
// tryGrowByReslice is an inlineable version of grow for the fast-case where the
|
||||||
// internal buffer only needs to be resliced.
|
// internal buffer only needs to be resliced.
|
||||||
// It returns the index where bytes should be written and whether it succeeded.
|
// It returns the index where bytes should be written and whether it succeeded.
|
||||||
func (b *Buffer) tryGrowByReslice(n int) (int, bool) {
|
func (b *Buffer) tryGrowByReslice(n int) (int, bool) {
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,7 @@ func (t *node32) lub(key int32, allow_eq bool) *node32 {
|
||||||
// t is too small, lub is to right.
|
// t is too small, lub is to right.
|
||||||
t = t.right
|
t = t.right
|
||||||
} else {
|
} else {
|
||||||
// t is a upper bound, record it and seek a better one.
|
// t is an upper bound, record it and seek a better one.
|
||||||
best = t
|
best = t
|
||||||
t = t.left
|
t = t.left
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ func (n *InlinedCallExpr) SingleResult() Node {
|
||||||
return n.ReturnVars[0]
|
return n.ReturnVars[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// A LogicalExpr is a expression X Op Y where Op is && or ||.
|
// A LogicalExpr is an expression X Op Y where Op is && or ||.
|
||||||
// It is separate from BinaryExpr to make room for statements
|
// It is separate from BinaryExpr to make room for statements
|
||||||
// that must be executed before Y but after X.
|
// that must be executed before Y but after X.
|
||||||
type LogicalExpr struct {
|
type LogicalExpr struct {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ func Int64Val(n Node) int64 {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint64Val returns n as an uint64.
|
// Uint64Val returns n as a uint64.
|
||||||
// n must be an integer or rune constant.
|
// n must be an integer or rune constant.
|
||||||
func Uint64Val(n Node) uint64 {
|
func Uint64Val(n Node) uint64 {
|
||||||
if !IsConst(n, constant.Int) {
|
if !IsConst(n, constant.Int) {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ func findIndVar(f *Func) []indVar {
|
||||||
var init *Value // starting value
|
var init *Value // starting value
|
||||||
var limit *Value // ending value
|
var limit *Value // ending value
|
||||||
|
|
||||||
// Check thet the control if it either ind </<= limit or limit </<= ind.
|
// Check that the control if it either ind </<= limit or limit </<= ind.
|
||||||
// TODO: Handle unsigned comparisons?
|
// TODO: Handle unsigned comparisons?
|
||||||
c := b.Controls[0]
|
c := b.Controls[0]
|
||||||
inclusive := false
|
inclusive := false
|
||||||
|
|
@ -117,12 +117,12 @@ func findIndVar(f *Func) []indVar {
|
||||||
// for i := len(n)-1; i >= 0; i--
|
// for i := len(n)-1; i >= 0; i--
|
||||||
init, inc, nxt = parseIndVar(limit)
|
init, inc, nxt = parseIndVar(limit)
|
||||||
if init == nil {
|
if init == nil {
|
||||||
// No recognied induction variable on either operand
|
// No recognized induction variable on either operand
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok, the arguments were reversed. Swap them, and remember that we're
|
// Ok, the arguments were reversed. Swap them, and remember that we're
|
||||||
// looking at a ind >/>= loop (so the induction must be decrementing).
|
// looking at an ind >/>= loop (so the induction must be decrementing).
|
||||||
ind, limit = limit, ind
|
ind, limit = limit, ind
|
||||||
less = false
|
less = false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ const (
|
||||||
auxARM64BitField // aux is an arm64 bitfield lsb and width packed into auxInt
|
auxARM64BitField // aux is an arm64 bitfield lsb and width packed into auxInt
|
||||||
auxS390XRotateParams // aux is a s390x rotate parameters object encoding start bit, end bit and rotate amount
|
auxS390XRotateParams // aux is a s390x rotate parameters object encoding start bit, end bit and rotate amount
|
||||||
auxS390XCCMask // aux is a s390x 4-bit condition code mask
|
auxS390XCCMask // aux is a s390x 4-bit condition code mask
|
||||||
auxS390XCCMaskInt8 // aux is a s390x 4-bit condition code mask, auxInt is a int8 immediate
|
auxS390XCCMaskInt8 // aux is a s390x 4-bit condition code mask, auxInt is an int8 immediate
|
||||||
auxS390XCCMaskUint8 // aux is a s390x 4-bit condition code mask, auxInt is a uint8 immediate
|
auxS390XCCMaskUint8 // aux is a s390x 4-bit condition code mask, auxInt is a uint8 immediate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// posetUndo represents an undo pass to be performed.
|
// posetUndo represents an undo pass to be performed.
|
||||||
// It's an union of fields that can be used to store information,
|
// It's a union of fields that can be used to store information,
|
||||||
// and typ is the discriminant, that specifies which kind
|
// and typ is the discriminant, that specifies which kind
|
||||||
// of operation must be performed. Not all fields are always used.
|
// of operation must be performed. Not all fields are always used.
|
||||||
type posetUndo struct {
|
type posetUndo struct {
|
||||||
|
|
|
||||||
|
|
@ -1345,7 +1345,7 @@ func (t *Type) IsUnsafePtr() bool {
|
||||||
return t.kind == TUNSAFEPTR
|
return t.kind == TUNSAFEPTR
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsUintptr reports whether t is an uintptr.
|
// IsUintptr reports whether t is a uintptr.
|
||||||
func (t *Type) IsUintptr() bool {
|
func (t *Type) IsUintptr() bool {
|
||||||
return t.kind == TUINTPTR
|
return t.kind == TUINTPTR
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -609,7 +609,7 @@ func isAppendOfMake(n ir.Node) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// y must be either an integer constant or the largest possible positive value
|
// y must be either an integer constant or the largest possible positive value
|
||||||
// of variable y needs to fit into an uint.
|
// of variable y needs to fit into a uint.
|
||||||
|
|
||||||
// typecheck made sure that constant arguments to make are not negative and fit into an int.
|
// typecheck made sure that constant arguments to make are not negative and fit into an int.
|
||||||
|
|
||||||
|
|
@ -652,7 +652,7 @@ func isAppendOfMake(n ir.Node) bool {
|
||||||
// growslice will have done the clearing for us.
|
// growslice will have done the clearing for us.
|
||||||
|
|
||||||
func extendSlice(n *ir.CallExpr, init *ir.Nodes) ir.Node {
|
func extendSlice(n *ir.CallExpr, init *ir.Nodes) ir.Node {
|
||||||
// isAppendOfMake made sure all possible positive values of l2 fit into an uint.
|
// isAppendOfMake made sure all possible positive values of l2 fit into a uint.
|
||||||
// The case of l2 overflow when converting from e.g. uint to int is handled by an explicit
|
// The case of l2 overflow when converting from e.g. uint to int is handled by an explicit
|
||||||
// check of l2 < 0 at runtime which is generated below.
|
// check of l2 < 0 at runtime which is generated below.
|
||||||
l2 := typecheck.Conv(n.Args[1].(*ir.MakeExpr).Len, types.Types[types.TINT])
|
l2 := typecheck.Conv(n.Args[1].(*ir.MakeExpr).Len, types.Types[types.TINT])
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,7 @@ func addpad(pc, a int64, ctxt *obj.Link, cursym *obj.LSym) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the implied register of a operand which doesn't specify one. These show up
|
// Get the implied register of an operand which doesn't specify one. These show up
|
||||||
// in handwritten asm like "MOVD R5, foosymbol" where a base register is not supplied,
|
// in handwritten asm like "MOVD R5, foosymbol" where a base register is not supplied,
|
||||||
// or "MOVD R5, foo+10(SP) or pseudo-register is used. The other common case is when
|
// or "MOVD R5, foo+10(SP) or pseudo-register is used. The other common case is when
|
||||||
// generating constants in register like "MOVD $constant, Rx".
|
// generating constants in register like "MOVD $constant, Rx".
|
||||||
|
|
|
||||||
|
|
@ -1691,7 +1691,7 @@ func instructionForProg(p *obj.Prog) *instruction {
|
||||||
return ins
|
return ins
|
||||||
}
|
}
|
||||||
|
|
||||||
// instructionsForOpImmediate returns the machine instructions for a immedate
|
// instructionsForOpImmediate returns the machine instructions for an immediate
|
||||||
// operand. The instruction is specified by as and the source register is
|
// operand. The instruction is specified by as and the source register is
|
||||||
// specified by rs, instead of the obj.Prog.
|
// specified by rs, instead of the obj.Prog.
|
||||||
func instructionsForOpImmediate(p *obj.Prog, as obj.As, rs int16) []*instruction {
|
func instructionsForOpImmediate(p *obj.Prog, as obj.As, rs int16) []*instruction {
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
|
||||||
|
|
||||||
// Offset is the location of the param on the Go stack (ie relative to sp).
|
// Offset is the location of the param on the Go stack (ie relative to sp).
|
||||||
// Because of our call convention, the parameters are located an additional 8 bytes
|
// Because of our call convention, the parameters are located an additional 8 bytes
|
||||||
// from sp because we store the return address as a int64 at the bottom of the stack.
|
// from sp because we store the return address as an int64 at the bottom of the stack.
|
||||||
// Ie the stack looks like [return_addr, param3, param2, param1, etc]
|
// Ie the stack looks like [return_addr, param3, param2, param1, etc]
|
||||||
|
|
||||||
// Ergo, we add 8 to the true byte offset of the param to skip the return address.
|
// Ergo, we add 8 to the true byte offset of the param to skip the return address.
|
||||||
|
|
|
||||||
|
|
@ -1677,7 +1677,7 @@ func (ctxt *Link) dodata(symGroupType []sym.SymKind) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocateDataSectionForSym creates a new sym.Section into which a a
|
// allocateDataSectionForSym creates a new sym.Section into which a
|
||||||
// single symbol will be placed. Here "seg" is the segment into which
|
// single symbol will be placed. Here "seg" is the segment into which
|
||||||
// the section will go, "s" is the symbol to be placed into the new
|
// the section will go, "s" is the symbol to be placed into the new
|
||||||
// section, and "rwx" contains permissions for the section.
|
// section, and "rwx" contains permissions for the section.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const (
|
||||||
// XCOFF binaries should normally have all its sections position-independent.
|
// XCOFF binaries should normally have all its sections position-independent.
|
||||||
// However, this is not yet possible for .text because of some R_ADDR relocations
|
// However, this is not yet possible for .text because of some R_ADDR relocations
|
||||||
// inside RODATA symbols.
|
// inside RODATA symbols.
|
||||||
// .data and .bss are position-independent so their address start inside a unreachable
|
// .data and .bss are position-independent so their address start inside an unreachable
|
||||||
// segment during execution to force segfault if something is wrong.
|
// segment during execution to force segfault if something is wrong.
|
||||||
XCOFFTEXTBASE = 0x100000000 // Start of text address
|
XCOFFTEXTBASE = 0x100000000 // Start of text address
|
||||||
XCOFFDATABASE = 0x200000000 // Start of data address
|
XCOFFDATABASE = 0x200000000 // Start of data address
|
||||||
|
|
@ -875,7 +875,7 @@ func (f *xcoffFile) writeSymbolFunc(ctxt *Link, x loader.Sym) []xcoffSym {
|
||||||
// put function used by genasmsym to write symbol table.
|
// put function used by genasmsym to write symbol table.
|
||||||
func putaixsym(ctxt *Link, x loader.Sym, t SymbolType) {
|
func putaixsym(ctxt *Link, x loader.Sym, t SymbolType) {
|
||||||
// All XCOFF symbols generated by this GO symbols
|
// All XCOFF symbols generated by this GO symbols
|
||||||
// Can be a symbol entry or a auxiliary entry
|
// Can be a symbol entry or an auxiliary entry
|
||||||
syms := []xcoffSym{}
|
syms := []xcoffSym{}
|
||||||
|
|
||||||
ldr := ctxt.loader
|
ldr := ctxt.loader
|
||||||
|
|
@ -1329,7 +1329,7 @@ func (ctxt *Link) doxcoff() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ldr.SymType(s) == sym.STEXT {
|
if ldr.SymType(s) == sym.STEXT {
|
||||||
// On AIX, a exported function must have two symbols:
|
// On AIX, an exported function must have two symbols:
|
||||||
// - a .text symbol which must start with a ".".
|
// - a .text symbol which must start with a ".".
|
||||||
// - a .data symbol which is a function descriptor.
|
// - a .data symbol which is a function descriptor.
|
||||||
name := ldr.SymExtname(s)
|
name := ldr.SymExtname(s)
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ const (
|
||||||
// a jump to the loaded value.
|
// a jump to the loaded value.
|
||||||
CreateImportStubPltToken = -2
|
CreateImportStubPltToken = -2
|
||||||
|
|
||||||
// When stored into the GOT value for a import symbol __imp_X this
|
// When stored into the GOT value for an import symbol __imp_X this
|
||||||
// token tells windynrelocsym to redirect references to the
|
// token tells windynrelocsym to redirect references to the
|
||||||
// underlying DYNIMPORT symbol X.
|
// underlying DYNIMPORT symbol X.
|
||||||
RedirectToDynImportGotToken = -2
|
RedirectToDynImportGotToken = -2
|
||||||
|
|
|
||||||
|
|
@ -704,7 +704,7 @@ func xcoffreloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sy
|
||||||
}
|
}
|
||||||
|
|
||||||
func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, ri int, sectoff int64) bool {
|
func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, ri int, sectoff int64) bool {
|
||||||
// Beware that bit0~bit15 start from the third byte of a instruction in Big-Endian machines.
|
// Beware that bit0~bit15 start from the third byte of an instruction in Big-Endian machines.
|
||||||
rt := r.Type
|
rt := r.Type
|
||||||
if rt == objabi.R_ADDR || rt == objabi.R_POWER_TLS || rt == objabi.R_CALLPOWER {
|
if rt == objabi.R_ADDR || rt == objabi.R_POWER_TLS || rt == objabi.R_CALLPOWER {
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ func (s *Scalar) Set(x *Scalar) *Scalar {
|
||||||
// If x is not of the right length, SetUniformBytes returns nil and an error,
|
// If x is not of the right length, SetUniformBytes returns nil and an error,
|
||||||
// and the receiver is unchanged.
|
// and the receiver is unchanged.
|
||||||
//
|
//
|
||||||
// SetUniformBytes can be used to set s to an uniformly distributed value given
|
// SetUniformBytes can be used to set s to a uniformly distributed value given
|
||||||
// 64 uniformly distributed random bytes.
|
// 64 uniformly distributed random bytes.
|
||||||
func (s *Scalar) SetUniformBytes(x []byte) (*Scalar, error) {
|
func (s *Scalar) SetUniformBytes(x []byte) (*Scalar, error) {
|
||||||
if len(x) != 64 {
|
if len(x) != 64 {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ type cacheEntry struct {
|
||||||
// multiple Conns. Returned references should not be mutated by callers. Certificates
|
// multiple Conns. Returned references should not be mutated by callers. Certificates
|
||||||
// are still safe to use after they are removed from the cache.
|
// are still safe to use after they are removed from the cache.
|
||||||
//
|
//
|
||||||
// Certificates are returned wrapped in a activeCert struct that should be held by
|
// Certificates are returned wrapped in an activeCert struct that should be held by
|
||||||
// the caller. When references to the activeCert are freed, the number of references
|
// the caller. When references to the activeCert are freed, the number of references
|
||||||
// to the certificate in the cache is decremented. Once the number of references
|
// to the certificate in the cache is decremented. Once the number of references
|
||||||
// reaches zero, the entry is evicted from the cache.
|
// reaches zero, the entry is evicted from the cache.
|
||||||
|
|
@ -49,7 +49,7 @@ type activeCert struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// active increments the number of references to the entry, wraps the
|
// active increments the number of references to the entry, wraps the
|
||||||
// certificate in the entry in a activeCert, and sets the finalizer.
|
// certificate in the entry in an activeCert, and sets the finalizer.
|
||||||
//
|
//
|
||||||
// Note that there is a race between active and the finalizer set on the
|
// Note that there is a race between active and the finalizer set on the
|
||||||
// returned activeCert, triggered if active is called after the ref count is
|
// returned activeCert, triggered if active is called after the ref count is
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ type pkcs8 struct {
|
||||||
|
|
||||||
// ParsePKCS8PrivateKey parses an unencrypted private key in PKCS #8, ASN.1 DER form.
|
// ParsePKCS8PrivateKey parses an unencrypted private key in PKCS #8, ASN.1 DER form.
|
||||||
//
|
//
|
||||||
// It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, a ed25519.PrivateKey (not
|
// It returns a *rsa.PrivateKey, an *ecdsa.PrivateKey, an ed25519.PrivateKey (not
|
||||||
// a pointer), or a *ecdh.PrivateKey (for X25519). More types might be supported
|
// a pointer), or an *ecdh.PrivateKey (for X25519). More types might be supported
|
||||||
// in the future.
|
// in the future.
|
||||||
//
|
//
|
||||||
// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY".
|
// This kind of key is commonly encoded in PEM blocks of type "PRIVATE KEY".
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ func (e *FormatError) Error() string {
|
||||||
return "unknown error"
|
return "unknown error"
|
||||||
}
|
}
|
||||||
|
|
||||||
// readOptionalHeader accepts a io.ReadSeeker pointing to optional header in the PE file
|
// readOptionalHeader accepts an io.ReadSeeker pointing to optional header in the PE file
|
||||||
// and its size as seen in the file header.
|
// and its size as seen in the file header.
|
||||||
// It parses the given size of bytes and returns optional header. It infers whether the
|
// It parses the given size of bytes and returns optional header. It infers whether the
|
||||||
// bytes being parsed refer to 32 bit or 64 bit version of optional header.
|
// bytes being parsed refer to 32 bit or 64 bit version of optional header.
|
||||||
|
|
@ -612,7 +612,7 @@ func readOptionalHeader(r io.ReadSeeker, sz uint16) (any, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// readDataDirectories accepts a io.ReadSeeker pointing to data directories in the PE file,
|
// readDataDirectories accepts an io.ReadSeeker pointing to data directories in the PE file,
|
||||||
// its size and number of data directories as seen in optional header.
|
// its size and number of data directories as seen in optional header.
|
||||||
// It parses the given size of bytes and returns given number of data directories.
|
// It parses the given size of bytes and returns given number of data directories.
|
||||||
func readDataDirectories(r io.ReadSeeker, sz uint16, n uint32) ([]DataDirectory, error) {
|
func readDataDirectories(r io.ReadSeeker, sz uint16, n uint32) ([]DataDirectory, error) {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ func (enc *Encoder) setError(err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeMessage sends the data item preceded by a unsigned count of its length.
|
// writeMessage sends the data item preceded by an unsigned count of its length.
|
||||||
func (enc *Encoder) writeMessage(w io.Writer, b *encBuffer) {
|
func (enc *Encoder) writeMessage(w io.Writer, b *encBuffer) {
|
||||||
// Space has been reserved for the length at the head of the message.
|
// Space has been reserved for the length at the head of the message.
|
||||||
// This is a little dirty: we grab the slice from the bytes.Buffer and massage
|
// This is a little dirty: we grab the slice from the bytes.Buffer and massage
|
||||||
|
|
|
||||||
|
|
@ -1213,7 +1213,7 @@ parseElements:
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rfindley): the error produced here could be improved, since we could
|
// TODO(rfindley): the error produced here could be improved, since we could
|
||||||
// accept a identifier, 'type', or a '}' at this point.
|
// accept an identifier, 'type', or a '}' at this point.
|
||||||
rbrace := p.expect(token.RBRACE)
|
rbrace := p.expect(token.RBRACE)
|
||||||
|
|
||||||
return &ast.InterfaceType{
|
return &ast.InterfaceType{
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ func induceSubS_8_32(text []byte, sa, freq, bucket []int32) {
|
||||||
// Second, to avoid text comparison entirely, if an LMS-substring is very short,
|
// Second, to avoid text comparison entirely, if an LMS-substring is very short,
|
||||||
// sa[j/2] records its actual text instead of its length, so that if two such
|
// sa[j/2] records its actual text instead of its length, so that if two such
|
||||||
// substrings have matching “length,” the text need not be read at all.
|
// substrings have matching “length,” the text need not be read at all.
|
||||||
// The definition of “very short” is that the text bytes must pack into an uint32,
|
// The definition of “very short” is that the text bytes must pack into a uint32,
|
||||||
// and the unsigned encoding e must be ≥ len(text), so that it can be
|
// and the unsigned encoding e must be ≥ len(text), so that it can be
|
||||||
// distinguished from a valid length.
|
// distinguished from a valid length.
|
||||||
func length_8_32(text []byte, sa []int32, numLMS int) {
|
func length_8_32(text []byte, sa []int32, numLMS int) {
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ func NewArchive(r io.ReaderAt) (*Archive, error) {
|
||||||
|
|
||||||
// GetFile returns the XCOFF file defined by member name.
|
// GetFile returns the XCOFF file defined by member name.
|
||||||
// FIXME: This doesn't work if an archive has two members with the same
|
// FIXME: This doesn't work if an archive has two members with the same
|
||||||
// name which can occur if a archive has both 32-bits and 64-bits files.
|
// name which can occur if an archive has both 32-bits and 64-bits files.
|
||||||
func (arch *Archive) GetFile(name string) (*File, error) {
|
func (arch *Archive) GetFile(name string) (*File, error) {
|
||||||
for _, mem := range arch.Members {
|
for _, mem := range arch.Members {
|
||||||
if mem.Name == name {
|
if mem.Name == name {
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ func (rng *rngSource) Int63() int64 {
|
||||||
return int64(rng.Uint64() & rngMask)
|
return int64(rng.Uint64() & rngMask)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint64 returns a non-negative pseudo-random 64-bit integer as an uint64.
|
// Uint64 returns a non-negative pseudo-random 64-bit integer as a uint64.
|
||||||
func (rng *rngSource) Uint64() uint64 {
|
func (rng *rngSource) Uint64() uint64 {
|
||||||
rng.tap--
|
rng.tap--
|
||||||
if rng.tap < 0 {
|
if rng.tap < 0 {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// wrapSyscallError takes an error and a syscall name. If the error is
|
// wrapSyscallError takes an error and a syscall name. If the error is
|
||||||
// a syscall.Errno, it wraps it in a os.SyscallError using the syscall name.
|
// a syscall.Errno, it wraps it in an os.SyscallError using the syscall name.
|
||||||
func wrapSyscallError(name string, err error) error {
|
func wrapSyscallError(name string, err error) error {
|
||||||
if _, ok := err.(syscall.Errno); ok {
|
if _, ok := err.(syscall.Errno); ok {
|
||||||
err = os.NewSyscallError(name, err)
|
err = os.NewSyscallError(name, err)
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ func isIP(host string) bool {
|
||||||
return net.ParseIP(host) != nil
|
return net.ParseIP(host) != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaultPath returns the directory part of an URL's path according to
|
// defaultPath returns the directory part of a URL's path according to
|
||||||
// RFC 6265 section 5.1.4.
|
// RFC 6265 section 5.1.4.
|
||||||
func defaultPath(path string) string {
|
func defaultPath(path string) string {
|
||||||
if len(path) == 0 || path[0] != '/' {
|
if len(path) == 0 || path[0] != '/' {
|
||||||
|
|
@ -379,7 +379,7 @@ func defaultPath(path string) string {
|
||||||
return path[:i] // Path is either of form "/abc/xyz" or "/abc/xyz/".
|
return path[:i] // Path is either of form "/abc/xyz" or "/abc/xyz/".
|
||||||
}
|
}
|
||||||
|
|
||||||
// newEntry creates an entry from a http.Cookie c. now is the current time and
|
// newEntry creates an entry from an http.Cookie c. now is the current time and
|
||||||
// is compared to c.Expires to determine deletion of c. defPath and host are the
|
// is compared to c.Expires to determine deletion of c. defPath and host are the
|
||||||
// default-path and the canonical host name of the URL c was received from.
|
// default-path and the canonical host name of the URL c was received from.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -3474,7 +3474,7 @@ func convertOp(dst, src *rtype) func(Value, Type) Value {
|
||||||
if dst.Kind() == Pointer && dst.Elem().Kind() == Array && src.Elem() == dst.Elem().Elem() {
|
if dst.Kind() == Pointer && dst.Elem().Kind() == Array && src.Elem() == dst.Elem().Elem() {
|
||||||
return cvtSliceArrayPtr
|
return cvtSliceArrayPtr
|
||||||
}
|
}
|
||||||
// "x is a slice, T is a array type,
|
// "x is a slice, T is an array type,
|
||||||
// and the slice and array types have identical element types."
|
// and the slice and array types have identical element types."
|
||||||
if dst.Kind() == Array && src.Elem() == dst.Elem() {
|
if dst.Kind() == Array && src.Elem() == dst.Elem() {
|
||||||
return cvtSliceArray
|
return cvtSliceArray
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ func panicdottypeI(have *itab, want, iface *_type) {
|
||||||
panicdottypeE(t, want, iface)
|
panicdottypeE(t, want, iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
// panicnildottype is called when doing a i.(T) conversion and the interface i is nil.
|
// panicnildottype is called when doing an i.(T) conversion and the interface i is nil.
|
||||||
// want = the static type we're trying to convert to.
|
// want = the static type we're trying to convert to.
|
||||||
func panicnildottype(want *_type) {
|
func panicnildottype(want *_type) {
|
||||||
panic(&TypeAssertionError{nil, nil, want, ""})
|
panic(&TypeAssertionError{nil, nil, want, ""})
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,7 @@ func (e *ValueError) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyBytesToGo copies bytes from src to dst.
|
// CopyBytesToGo copies bytes from src to dst.
|
||||||
// It panics if src is not an Uint8Array or Uint8ClampedArray.
|
// It panics if src is not a Uint8Array or Uint8ClampedArray.
|
||||||
// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
|
// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
|
||||||
func CopyBytesToGo(dst []byte, src Value) int {
|
func CopyBytesToGo(dst []byte, src Value) int {
|
||||||
n, ok := copyBytesToGo(dst, src.ref)
|
n, ok := copyBytesToGo(dst, src.ref)
|
||||||
|
|
@ -585,7 +585,7 @@ func CopyBytesToGo(dst []byte, src Value) int {
|
||||||
func copyBytesToGo(dst []byte, src ref) (int, bool)
|
func copyBytesToGo(dst []byte, src ref) (int, bool)
|
||||||
|
|
||||||
// CopyBytesToJS copies bytes from src to dst.
|
// CopyBytesToJS copies bytes from src to dst.
|
||||||
// It panics if dst is not an Uint8Array or Uint8ClampedArray.
|
// It panics if dst is not a Uint8Array or Uint8ClampedArray.
|
||||||
// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
|
// It returns the number of bytes copied, which will be the minimum of the lengths of src and dst.
|
||||||
func CopyBytesToJS(dst Value, src []byte) int {
|
func CopyBytesToJS(dst Value, src []byte) int {
|
||||||
n, ok := copyBytesToJS(dst.ref, src)
|
n, ok := copyBytesToJS(dst.ref, src)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue