if err != nil {
return err
}
- hdr.Size = int64(size)
+ hdr.Size = size
default:
if strings.HasPrefix(k, paxXattr) {
if hdr.Xattrs == nil {
// Right truncate
nano_buf = nano_buf[:maxNanoSecondIntSize]
}
- nanoseconds, err = strconv.ParseInt(string(nano_buf), 10, 0)
+ nanoseconds, err = strconv.ParseInt(nano_buf, 10, 0)
if err != nil {
return time.Time{}, err
}
}
sbuf = residual
- keyStr := string(key)
+ keyStr := key
if keyStr == paxGNUSparseOffset || keyStr == paxGNUSparseNumBytes {
// GNU sparse format 0.0 special key. Write to sparseMap instead of using the headers map.
sparseMap.WriteString(value)
sparseMap.Write([]byte{','})
} else {
// Normal key. Set the value in the headers map.
- headers[keyStr] = string(value)
+ headers[keyStr] = value
}
}
if sparseMap.Len() != 0 {
return err
}
}
- tw.nb = int64(hdr.Size)
+ tw.nb = hdr.Size
tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize
_, tw.err = tw.w.Write(header)
case 0:
abs = offset
case 1:
- abs = int64(r.i) + offset
+ abs = r.i + offset
case 2:
abs = int64(len(r.s)) + offset
default:
}
bz2.fileCRC = 0
- bz2.blockSize = 100 * 1000 * (int(level) - '0')
+ bz2.blockSize = 100 * 1000 * (level - '0')
if bz2.blockSize > len(bz2.tt) {
bz2.tt = make([]uint32, bz2.blockSize)
}
if c >= numHuffmanTrees {
return StructuralError("tree index too large")
}
- treeIndexes[i] = uint8(mtfTreeDecoder.Decode(c))
+ treeIndexes[i] = mtfTreeDecoder.Decode(c)
}
// The list of symbols for the move-to-front transform is taken from
return StructuralError("repeats past end of block")
}
for i := 0; i < repeat; i++ {
- b := byte(mtf.First())
+ b := mtf.First()
bz2.tt[bufIndex] = uint32(b)
bz2.c[b]++
bufIndex++
// it's always referenced with a run-length of 1. Thus 0
// doesn't need to be encoded and we have |v-1| in the next
// line.
- b := byte(mtf.Decode(int(v - 1)))
+ b := mtf.Decode(int(v - 1))
if bufIndex >= bz2.blockSize {
return StructuralError("data exceeds block size")
}
}
dynamicHeader := int64(3+5+5+4+(3*numCodegens)) +
w.codegenEncoding.bitLength(w.codegenFreq[:]) +
- int64(extraBits) +
+ extraBits +
int64(w.codegenFreq[16]*2) +
int64(w.codegenFreq[17]*3) +
int64(w.codegenFreq[18]*7)
}
func reverseBits(number uint16, bitLength byte) uint16 {
- return reverseUint16(number << uint8(16-bitLength))
+ return reverseUint16(number << (16 - bitLength))
}
if err := e.write(e, clear); err != nil {
return err
}
- e.width = uint(e.litWidth) + 1
+ e.width = e.litWidth + 1
e.hi = clear + 1
e.overflow = clear << 1
for i := range e.table {
for i := 0; i < 4; i++ {
for j := 0; j < 16; j++ {
f := uint64(sBoxes[s][i][j]) << (4 * (7 - uint(s)))
- f = permuteBlock(uint64(f), permutationFunction[:])
+ f = permuteBlock(f, permutationFunction[:])
feistelBox[s][16*i+j] = uint32(f)
}
}
z[4] = byte(l)
z = z[5:]
for _, pointFormat := range m.supportedPoints {
- z[0] = byte(pointFormat)
+ z[0] = pointFormat
z = z[1:]
}
}
z := x[39+len(m.sessionId):]
z[0] = uint8(m.cipherSuite >> 8)
z[1] = uint8(m.cipherSuite)
- z[2] = uint8(m.compressionMethod)
+ z[2] = m.compressionMethod
z = z[3:]
if numExtensions > 0 {
case 4:
return uint64(b.uint32())
case 8:
- return uint64(b.uint64())
+ return b.uint64()
}
b.error("unknown address size")
return 0
// Special opcode [DWARF2 6.2.5.1, DWARF4 6.2.5.1]
adjustedOpcode := opcode - r.opcodeBase
r.advancePC(adjustedOpcode / r.lineRange)
- lineDelta := r.lineBase + int(adjustedOpcode)%r.lineRange
+ lineDelta := r.lineBase + adjustedOpcode%r.lineRange
r.state.Line += lineDelta
goto emit
}
data: b.bytes(int(n - (b.off - hdroff))),
atable: atable,
asize: int(asize),
- vers: int(vers),
+ vers: vers,
is64: dwarf64,
},
toff: Offset(toff),
b := makeBuf(d, tu, tu.name, tu.off, tu.data)
r := &typeUnitReader{d: d, tu: tu, b: b}
- t, err := d.readType(tu.name, r, Offset(tu.toff), make(map[Offset]Type), nil)
+ t, err := d.readType(tu.name, r, tu.toff, make(map[Offset]Type), nil)
if err != nil {
return nil, err
}
Addend int32 /* Addend. */
}
-func R_SYM32(info uint32) uint32 { return uint32(info >> 8) }
-func R_TYPE32(info uint32) uint32 { return uint32(info & 0xff) }
+func R_SYM32(info uint32) uint32 { return info >> 8 }
+func R_TYPE32(info uint32) uint32 { return info & 0xff }
func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ }
// ELF32 Symbol.
}
f.Type = Type(hdr.Type)
f.Machine = Machine(hdr.Machine)
- f.Entry = uint64(hdr.Entry)
+ f.Entry = hdr.Entry
if v := Version(hdr.Version); v != f.Version {
return nil, &FormatError{0, "mismatched ELF version", v}
}
p.ProgHeader = ProgHeader{
Type: ProgType(ph.Type),
Flags: ProgFlag(ph.Flags),
- Off: uint64(ph.Off),
- Vaddr: uint64(ph.Vaddr),
- Paddr: uint64(ph.Paddr),
- Filesz: uint64(ph.Filesz),
- Memsz: uint64(ph.Memsz),
- Align: uint64(ph.Align),
+ Off: ph.Off,
+ Vaddr: ph.Vaddr,
+ Paddr: ph.Paddr,
+ Filesz: ph.Filesz,
+ Memsz: ph.Memsz,
+ Align: ph.Align,
}
}
p.sr = io.NewSectionReader(r, int64(p.Off), int64(p.Filesz))
Addr: uint64(sh.Addr),
Offset: uint64(sh.Off),
FileSize: uint64(sh.Size),
- Link: uint32(sh.Link),
- Info: uint32(sh.Info),
+ Link: sh.Link,
+ Info: sh.Info,
Addralign: uint64(sh.Addralign),
Entsize: uint64(sh.Entsize),
}
s.SectionHeader = SectionHeader{
Type: SectionType(sh.Type),
Flags: SectionFlag(sh.Flags),
- Offset: uint64(sh.Off),
- FileSize: uint64(sh.Size),
- Addr: uint64(sh.Addr),
- Link: uint32(sh.Link),
- Info: uint32(sh.Info),
- Addralign: uint64(sh.Addralign),
- Entsize: uint64(sh.Entsize),
+ Offset: sh.Off,
+ FileSize: sh.Size,
+ Addr: sh.Addr,
+ Link: sh.Link,
+ Info: sh.Info,
+ Addralign: sh.Addralign,
+ Entsize: sh.Entsize,
}
}
s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.FileSize))
funcs := make([]Func, n)
for i := range funcs {
f := &funcs[i]
- f.Entry = uint64(t.uintptr(t.functab[2*i*int(t.ptrsize):]))
- f.End = uint64(t.uintptr(t.functab[(2*i+2)*int(t.ptrsize):]))
+ f.Entry = t.uintptr(t.functab[2*i*int(t.ptrsize):])
+ f.End = t.uintptr(t.functab[(2*i+2)*int(t.ptrsize):])
info := t.Data[t.uintptr(t.functab[(2*i+1)*int(t.ptrsize):]):]
f.LineTable = t
f.FrameSize = int(t.binary.Uint32(info[t.ptrsize+2*4:]))
t.Syms = t.Syms[0 : n+1]
ts := &t.Syms[n]
ts.Type = s.typ
- ts.Value = uint64(s.value)
- ts.GoType = uint64(s.gotype)
+ ts.Value = s.value
+ ts.GoType = s.gotype
switch s.typ {
default:
// rewrite name to use . instead of · (c2 b7)
switch {
case 1950 <= year && year < 2000:
- err = marshalTwoDigits(out, int(year-1900))
+ err = marshalTwoDigits(out, year-1900)
case 2000 <= year && year < 2050:
- err = marshalTwoDigits(out, int(year-2000))
+ err = marshalTwoDigits(out, year-2000)
default:
return StructuralError{"cannot represent time as UTCTime"}
}
return out.WriteByte(0)
}
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return marshalInt64(out, int64(v.Int()))
+ return marshalInt64(out, v.Int())
case reflect.Struct:
t := v.Type()
case *uint8:
b[0] = *v
case uint8:
- b[0] = byte(v)
+ b[0] = v
case []uint8:
bs = v
case *int16:
} else {
x = uint64(i << 1)
}
- state.encodeUint(uint64(x))
+ state.encodeUint(x)
}
// encOp is the signature of an encoding operator for a given type.
}
comments := make([]string, len(g.List))
for i, c := range g.List {
- comments[i] = string(c.Text)
+ comments[i] = c.Text
}
lines := make([]string, 0, 10) // most comments are less than 10 lines
// CMYKToRGB converts a CMYK quadruple to an RGB triple.
func CMYKToRGB(c, m, y, k uint8) (uint8, uint8, uint8) {
- w := uint32(0xffff - uint32(k)*0x101)
- r := uint32(0xffff-uint32(c)*0x101) * w / 0xffff
- g := uint32(0xffff-uint32(m)*0x101) * w / 0xffff
- b := uint32(0xffff-uint32(y)*0x101) * w / 0xffff
+ w := 0xffff - uint32(k)*0x101
+ r := (0xffff - uint32(c)*0x101) * w / 0xffff
+ g := (0xffff - uint32(m)*0x101) * w / 0xffff
+ b := (0xffff - uint32(y)*0x101) * w / 0xffff
return uint8(r >> 8), uint8(g >> 8), uint8(b >> 8)
}
// This code is a copy of the CMYKToRGB function above, except that it
// returns values in the range [0, 0xffff] instead of [0, 0xff].
- w := uint32(0xffff - uint32(c.K)*0x101)
- r := uint32(0xffff-uint32(c.C)*0x101) * w / 0xffff
- g := uint32(0xffff-uint32(c.M)*0x101) * w / 0xffff
- b := uint32(0xffff-uint32(c.Y)*0x101) * w / 0xffff
- return uint32(r), uint32(g), uint32(b), 0xffff
+ w := 0xffff - uint32(c.K)*0x101
+ r := (0xffff - uint32(c.C)*0x101) * w / 0xffff
+ g := (0xffff - uint32(c.M)*0x101) * w / 0xffff
+ b := (0xffff - uint32(c.Y)*0x101) * w / 0xffff
+ return r, g, b, 0xffff
}
// CMYKModel is the Model for CMYK colors.
if !floydSteinberg {
continue
}
- er -= int32(palette[bestIndex][0])
- eg -= int32(palette[bestIndex][1])
- eb -= int32(palette[bestIndex][2])
- ea -= int32(palette[bestIndex][3])
+ er -= palette[bestIndex][0]
+ eg -= palette[bestIndex][1]
+ eb -= palette[bestIndex][2]
+ ea -= palette[bestIndex][3]
} else {
out.R = uint16(er)
if r.form == inf || e > emax {
// overflow
if x.neg {
- return float64(math.Inf(-1)), Below
+ return math.Inf(-1), Below
}
- return float64(math.Inf(+1)), Above
+ return math.Inf(+1), Above
}
// e <= emax
}
} else {
- bb, ndigits := maxPow(Word(b))
+ bb, ndigits := maxPow(b)
// construct table of successive squares of bb*leafSize to use in subdivisions
// result (table != nil) <=> (len(x) > leafSize > 0)
}
break // i > 0
}
- digits = append(digits, byte(ch))
+ digits = append(digits, ch)
}
// i > 0 => we have at least one digit
m.Data = m.Data[unsafe.Offsetof(sa.Data):]
var name [syscall.IFNAMSIZ]byte
for i := 0; i < int(sa.Nlen); i++ {
- name[i] = byte(m.Data[i])
+ name[i] = m.Data[i]
}
ifi.Name = string(name[:sa.Nlen])
ifi.MTU = int(m.Header.Data.Mtu)
addr := make([]byte, sa.Alen)
for i := 0; i < int(sa.Alen); i++ {
- addr[i] = byte(m.Data[int(sa.Nlen)+i])
+ addr[i] = m.Data[int(sa.Nlen)+i]
}
ifi.HardwareAddr = addr[:sa.Alen]
}
if i < p.len() && p.s[i] > 127 {
return "", errNonASCII
}
- atom, p.s = string(p.s[:i]), p.s[i:]
+ atom, p.s = p.s[:i], p.s[i:]
if !permissive {
if strings.HasPrefix(atom, ".") {
return "", errors.New("mail: leading dot in atom")
for i := 0; i < len(s); i++ {
if byteIndex(t, s[i]) >= 0 {
if last < i {
- a[n] = string(s[last:i])
+ a[n] = s[last:i]
n++
}
last = i + 1
}
}
if last < len(s) {
- a[n] = string(s[last:])
+ a[n] = s[last:]
n++
}
return a[0:n]
defer syscall.LocalFree(syscall.Handle(uintptr(unsafe.Pointer(argv))))
Args = make([]string, argc)
for i, v := range (*argv)[:argc] {
- Args[i] = string(syscall.UTF16ToString((*v)[:]))
+ Args[i] = syscall.UTF16ToString((*v)[:])
}
}
}
var e error
if file.isdir() {
- e = syscall.FindClose(syscall.Handle(file.fd))
+ e = syscall.FindClose(file.fd)
} else {
- e = syscall.CloseHandle(syscall.Handle(file.fd))
+ e = syscall.CloseHandle(file.fd)
}
var err error
if e != nil {
d := &file.dirinfo.data
for n != 0 && !file.dirinfo.isempty {
if file.dirinfo.needdata {
- e := syscall.FindNextFile(syscall.Handle(file.fd), d)
+ e := syscall.FindNextFile(file.fd, d)
if e != nil {
if e == syscall.ERROR_NO_MORE_FILES {
break
}
}
file.dirinfo.needdata = true
- name := string(syscall.UTF16ToString(d.FileName[0:]))
+ name := syscall.UTF16ToString(d.FileName[0:])
if name == "." || name == ".." { // Useless names
continue
}
}
wchars := make([]uint16, nwc)
pwc := &wchars[0]
- nwc, err = windows.MultiByteToWideChar(acp, 2, pmb, int32(nmb), pwc, int32(nwc))
+ nwc, err = windows.MultiByteToWideChar(acp, 2, pmb, int32(nmb), pwc, nwc)
if err != nil {
return 0, err
}
Offset: uint32(off),
}
var done uint32
- e = syscall.ReadFile(syscall.Handle(f.fd), b, &done, &o)
+ e = syscall.ReadFile(f.fd, b, &done, &o)
if e != nil {
if e == syscall.ERROR_HANDLE_EOF {
// end of file
Offset: uint32(off),
}
var done uint32
- e = syscall.WriteFile(syscall.Handle(f.fd), b, &done, &o)
+ e = syscall.WriteFile(f.fd, b, &done, &o)
if e != nil {
return 0, e
}
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtimespec)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtim)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
}
func timespecToTime(ts syscall.Timespec) time.Time {
- return time.Unix(int64(ts.Sec), int64(ts.Nsec))
+ return time.Unix(ts.Sec, ts.Nsec)
}
// For testing.
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtimespec)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtim)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtime, fs.sys.MtimeNsec)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtimespec)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
}
func timespecToTime(ts syscall.Timespec) time.Time {
- return time.Unix(int64(ts.Sec), int64(ts.Nsec))
+ return time.Unix(ts.Sec, int64(ts.Nsec))
}
// For testing.
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtim)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
}
func timespecToTime(ts syscall.Timespec) time.Time {
- return time.Unix(int64(ts.Sec), int64(ts.Nsec))
+ return time.Unix(ts.Sec, int64(ts.Nsec))
}
// For testing.
func fileInfoFromStat(d *syscall.Dir) FileInfo {
fs := &fileStat{
name: d.Name,
- size: int64(d.Length),
+ size: d.Length,
modTime: time.Unix(int64(d.Mtime), 0),
sys: d,
}
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
- fs.size = int64(fs.sys.Size)
+ fs.size = fs.sys.Size
fs.modTime = timespecToTime(fs.sys.Mtim)
fs.mode = FileMode(fs.sys.Mode & 0777)
switch fs.sys.Mode & syscall.S_IFMT {
}
func timespecToTime(ts syscall.Timespec) time.Time {
- return time.Unix(int64(ts.Sec), int64(ts.Nsec))
+ return time.Unix(ts.Sec, ts.Nsec)
}
// For testing.
}
var d syscall.ByHandleFileInformation
- err = syscall.GetFileInformationByHandle(syscall.Handle(file.fd), &d)
+ err = syscall.GetFileInformationByHandle(file.fd, &d)
if err != nil {
return nil, &PathError{"GetFileInformationByHandle", file.name, err}
}
}
defer syscall.CloseHandle(h)
var i syscall.ByHandleFileInformation
- err = syscall.GetFileInformationByHandle(syscall.Handle(h), &i)
+ err = syscall.GetFileInformationByHandle(h, &i)
if err != nil {
return err
}
}
func (t *funcType) in() []*rtype {
- uadd := uintptr(unsafe.Sizeof(*t))
+ uadd := unsafe.Sizeof(*t)
if t.tflag&tflagUncommon != 0 {
uadd += unsafe.Sizeof(uncommonType{})
}
}
func (t *funcType) out() []*rtype {
- uadd := uintptr(unsafe.Sizeof(*t))
+ uadd := unsafe.Sizeof(*t)
if t.tflag&tflagUncommon != 0 {
uadd += unsafe.Sizeof(uncommonType{})
}
case Array:
return v.typ.Len()
case Chan:
- return int(chancap(v.pointer()))
+ return chancap(v.pointer())
case Slice:
// Slice is always bigger than a word; assume flagIndir.
return (*sliceHeader)(v.ptr).Cap
case Int32:
return int64(*(*int32)(p))
case Int64:
- return int64(*(*int64)(p))
+ return *(*int64)(p)
}
panic(&ValueError{"reflect.Value.Int", v.kind()})
}
v.mustBeAssignable()
v.mustBe(Slice)
s := (*sliceHeader)(v.ptr)
- if n < int(s.Len) || n > int(s.Cap) {
+ if n < s.Len || n > s.Cap {
panic("reflect: slice capacity out of range in SetCap")
}
s.Cap = n
case Slice:
typ = (*sliceType)(unsafe.Pointer(v.typ))
s := (*sliceHeader)(v.ptr)
- base = unsafe.Pointer(s.Data)
+ base = s.Data
cap = s.Cap
case String:
case Uint32:
return uint64(*(*uint32)(p))
case Uint64:
- return uint64(*(*uint64)(p))
+ return *(*uint64)(p)
case Uintptr:
return uint64(*(*uintptr)(p))
}
ptr := unsafe_New(typ)
switch typ.size {
case 1:
- *(*uint8)(unsafe.Pointer(ptr)) = uint8(bits)
+ *(*uint8)(ptr) = uint8(bits)
case 2:
- *(*uint16)(unsafe.Pointer(ptr)) = uint16(bits)
+ *(*uint16)(ptr) = uint16(bits)
case 4:
- *(*uint32)(unsafe.Pointer(ptr)) = uint32(bits)
+ *(*uint32)(ptr) = uint32(bits)
case 8:
- *(*uint64)(unsafe.Pointer(ptr)) = bits
+ *(*uint64)(ptr) = bits
}
return Value{typ, ptr, f | flagIndir | flag(typ.Kind())}
}
ptr := unsafe_New(typ)
switch typ.size {
case 4:
- *(*float32)(unsafe.Pointer(ptr)) = float32(v)
+ *(*float32)(ptr) = float32(v)
case 8:
- *(*float64)(unsafe.Pointer(ptr)) = v
+ *(*float64)(ptr) = v
}
return Value{typ, ptr, f | flagIndir | flag(typ.Kind())}
}
ptr := unsafe_New(typ)
switch typ.size {
case 8:
- *(*complex64)(unsafe.Pointer(ptr)) = complex64(v)
+ *(*complex64)(ptr) = complex64(v)
case 16:
- *(*complex128)(unsafe.Pointer(ptr)) = v
+ *(*complex128)(ptr) = v
}
return Value{typ, ptr, f | flagIndir | flag(typ.Kind())}
}
for !instQueue.empty() {
visitQueue.clear()
pc := instQueue.next()
- if !check(uint32(pc), m) {
+ if !check(pc, m) {
p = notOnePass
break
}
var extrabits uint
if f.exp <= denormalExp {
// f.mant * 2^f.exp is smaller than 2^(flt.bias+1).
- extrabits = uint(63 - flt.mantbits + 1 + uint(denormalExp-f.exp))
+ extrabits = 63 - flt.mantbits + 1 + uint(denormalExp-f.exp)
} else {
- extrabits = uint(63 - flt.mantbits)
+ extrabits = 63 - flt.mantbits
}
halfway := uint64(1) << (extrabits - 1)
case 0:
abs = offset
case 1:
- abs = int64(r.i) + offset
+ abs = r.i + offset
case 2:
abs = int64(len(r.s)) + offset
default:
// If GOMAXPROCS changes between GCs, we re-allocate the array and lose the old one.
size := runtime.GOMAXPROCS(0)
local := make([]poolLocal, size)
- atomic.StorePointer((*unsafe.Pointer)(&p.local), unsafe.Pointer(&local[0])) // store-release
- atomic.StoreUintptr(&p.localSize, uintptr(size)) // store-release
+ atomic.StorePointer(&p.local, unsafe.Pointer(&local[0])) // store-release
+ atomic.StoreUintptr(&p.localSize, uintptr(size)) // store-release
return &local[pid]
}
// Add returns the time t+d.
func (t Time) Add(d Duration) Time {
t.sec += int64(d / 1e9)
- nsec := int32(t.nsec) + int32(d%1e9)
+ nsec := t.nsec + int32(d%1e9)
if nsec >= 1e9 {
t.sec++
nsec -= 1e9
// will be returned.
// To compute t-d for a duration d, use t.Add(-d).
func (t Time) Sub(u Time) Duration {
- d := Duration(t.sec-u.sec)*Second + Duration(int32(t.nsec)-int32(u.nsec))
+ d := Duration(t.sec-u.sec)*Second + Duration(t.nsec-u.nsec)
// Check for overflow or underflow.
switch {
case u.Add(d).Equal(t):
// but it's still here in case we change our minds.
func div(t Time, d Duration) (qmod2 int, r Duration) {
neg := false
- nsec := int32(t.nsec)
+ nsec := t.nsec
if t.sec < 0 {
// Operate on absolute value.
neg = true
tmp := (sec >> 32) * 1e9
u1 := tmp >> 32
u0 := tmp << 32
- tmp = uint64(sec&0xFFFFFFFF) * 1e9
+ tmp = (sec & 0xFFFFFFFF) * 1e9
u0x, u0 := u0, u0+tmp
if u0 < u0x {
u1++
var short []rune
for _, c := range desc {
if 'A' <= c && c <= 'Z' {
- short = append(short, rune(c))
+ short = append(short, c)
}
}
return string(short)
m := lo + (hi-lo)/2
cr := caseRange[m]
if rune(cr.Lo) <= r && r <= rune(cr.Hi) {
- delta := rune(cr.Delta[_case])
+ delta := cr.Delta[_case]
if delta > MaxRune {
// In an Upper-Lower sequence, which always starts with
// an UpperCase letter, the real deltas always look like: