Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for MulUintptr (0.36 sec)

  1. src/runtime/internal/math/math_test.go

    }
    
    func TestMulUintptr(t *testing.T) {
    	for _, test := range mulUintptrTests {
    		a, b := test.a, test.b
    		for i := 0; i < 2; i++ {
    			mul, overflow := MulUintptr(a, b)
    			if mul != a*b || overflow != test.overflow {
    				t.Errorf("MulUintptr(%v, %v) = %v, %v want %v, %v",
    					a, b, mul, overflow, a*b, test.overflow)
    			}
    			a, b = b, a
    		}
    	}
    }
    
    var SinkUintptr uintptr
    var SinkBool bool
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 15 19:04:09 UTC 2018
    - 1.7K bytes
    - Viewed (0)
  2. src/runtime/internal/math/math.go

    // license that can be found in the LICENSE file.
    
    package math
    
    import "internal/goarch"
    
    const MaxUintptr = ^uintptr(0)
    
    // MulUintptr returns a * b and whether the multiplication overflowed.
    // On supported platforms this is an intrinsic lowered by the compiler.
    func MulUintptr(a, b uintptr) (uintptr, bool) {
    	if a|b < 1<<(4*goarch.PtrSize) || a == 0 {
    		return a * b, false
    	}
    	overflow := b > MaxUintptr/a
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 16:03:04 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  3. src/runtime/slice.go

    func makeslicecopy(et *_type, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer {
    	var tomem, copymem uintptr
    	if uintptr(tolen) > uintptr(fromlen) {
    		var overflow bool
    		tomem, overflow = math.MulUintptr(et.Size_, uintptr(tolen))
    		if overflow || tomem > maxAlloc || tolen < 0 {
    			panicmakeslicelen()
    		}
    		copymem = et.Size_ * uintptr(fromlen)
    	} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  4. src/runtime/unsafe.go

    	if len < 0 {
    		panicunsafeslicelen1(getcallerpc())
    	}
    
    	if et.Size_ == 0 {
    		if ptr == nil && len > 0 {
    			panicunsafeslicenilptr1(getcallerpc())
    		}
    	}
    
    	mem, overflow := math.MulUintptr(et.Size_, uintptr(len))
    	if overflow || mem > -uintptr(ptr) {
    		if ptr == nil {
    			panicunsafeslicenilptr1(getcallerpc())
    		}
    		panicunsafeslicelen1(getcallerpc())
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:51:18 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/test/inl_test.go

    			"(*puintptr).set",
    			"(*wbBuf).get1",
    			"(*wbBuf).get2",
    
    			// Trace-related ones.
    			"traceLocker.ok",
    			"traceEnabled",
    		},
    		"runtime/internal/sys": {},
    		"runtime/internal/math": {
    			"MulUintptr",
    		},
    		"bytes": {
    			"(*Buffer).Bytes",
    			"(*Buffer).Cap",
    			"(*Buffer).Len",
    			"(*Buffer).Grow",
    			"(*Buffer).Next",
    			"(*Buffer).Read",
    			"(*Buffer).ReadByte",
    			"(*Buffer).Reset",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 09 04:07:57 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/walk/builtin.go

    				typecheck.Conv(len, types.Types[types.TINT]),
    				typecheck.Conv(len, types.Types[types.TINT]))
    			return walkExpr(typecheck.Expr(h), init)
    		}
    
    		// mem, overflow := math.mulUintptr(et.size, len)
    		mem := typecheck.TempAt(base.Pos, ir.CurFunc, types.Types[types.TUINTPTR])
    		overflow := typecheck.TempAt(base.Pos, ir.CurFunc, types.Types[types.TBOOL])
    
    		decl := types.NewSignature(nil,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 22:35:22 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  7. src/runtime/chan.go

    	if elem.Size_ >= 1<<16 {
    		throw("makechan: invalid channel element type")
    	}
    	if hchanSize%maxAlign != 0 || elem.Align_ > maxAlign {
    		throw("makechan: bad alignment")
    	}
    
    	mem, overflow := math.MulUintptr(elem.Size_, uintptr(size))
    	if overflow || mem > maxAlloc-hchanSize || size < 0 {
    		panic(plainError("makechan: size out of range"))
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:50 UTC 2024
    - 25.9K bytes
    - Viewed (0)
  8. src/runtime/arena.go

    // heap bitmap for n consecutive values with type typ allocated at address ptr.
    func userArenaHeapBitsSetSliceType(typ *_type, n int, ptr unsafe.Pointer, s *mspan) {
    	mem, overflow := math.MulUintptr(typ.Size_, uintptr(n))
    	if overflow || n < 0 || mem > maxAlloc {
    		panic(plainError("runtime: allocation size out of range"))
    	}
    	for i := 0; i < n; i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:44:56 UTC 2024
    - 37.9K bytes
    - Viewed (0)
  9. src/runtime/malloc.go

    // See go.dev/issue/67401.
    //
    //go:linkname newarray
    func newarray(typ *_type, n int) unsafe.Pointer {
    	if n == 1 {
    		return mallocgc(typ.Size_, typ, true)
    	}
    	mem, overflow := math.MulUintptr(typ.Size_, uintptr(n))
    	if overflow || mem > maxAlloc || n < 0 {
    		panic(plainError("runtime: allocation size out of range"))
    	}
    	return mallocgc(mem, typ, true)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 59.6K bytes
    - Viewed (0)
  10. src/runtime/map.go

    //   - github.com/ugorji/go/codec
    //
    // Do not remove or change the type signature.
    // See go.dev/issue/67401.
    //
    //go:linkname makemap
    func makemap(t *maptype, hint int, h *hmap) *hmap {
    	mem, overflow := math.MulUintptr(uintptr(hint), t.Bucket.Size_)
    	if overflow || mem > maxAlloc {
    		hint = 0
    	}
    
    	// initialize Hmap
    	if h == nil {
    		h = new(hmap)
    	}
    	h.hash0 = uint32(rand())
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 57.6K bytes
    - Viewed (0)
Back to top