Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for int64Multiply (0.22 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/resource/math_test.go

    		{-mostPositive, -mostPositive, 1, false},
    	} {
    		c, ok := int64Multiply(test.a, test.b)
    		if c != test.c {
    			t.Errorf("%v: unexpected result: %d", test, c)
    		}
    		if ok != test.ok {
    			t.Errorf("%v: unexpected overflow: %t", test, ok)
    		}
    		// multiplication is commutative
    		d, ok2 := int64Multiply(test.b, test.a)
    		if c != d || ok != ok2 {
    			t.Errorf("%v: not commutative: %d %t", test, d, ok2)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Jan 29 20:41:44 UTC 2017
    - 5.1K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/api/resource/math.go

    	case a < 0 && b < 0:
    		if c > 0 {
    			return 0, false
    		}
    		if a == mostNegative && b == mostNegative {
    			return 0, false
    		}
    	}
    	return c, true
    }
    
    // int64Multiply returns a*b, or false if that would overflow or underflow int64.
    func int64Multiply(a, b int64) (int64, bool) {
    	if a == 0 || b == 0 || a == 1 || b == 1 {
    		return a * b, true
    	}
    	if a == mostNegative || b == mostNegative {
    		return 0, false
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jan 23 13:07:14 UTC 2020
    - 7.3K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/api/resource/amount.go

    		a.scale = 0
    		return true
    	case a.scale == 0:
    		c, ok := int64Multiply(a.value, b)
    		if !ok {
    			return false
    		}
    		a.value = c
    	case a.scale > 0:
    		c, ok := int64Multiply(a.value, b)
    		if !ok {
    			return false
    		}
    		if _, ok = positiveScaleInt64(c, a.scale); !ok {
    			return false
    		}
    		a.value = c
    	default:
    		c, ok := int64Multiply(a.value, b)
    		if !ok {
    			return false
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Oct 13 19:42:28 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go

    		if scale >= int32(Nano) {
    			shifted := num + denom
    
    			var value int64
    			value, err := strconv.ParseInt(shifted, 10, 64)
    			if err != nil {
    				return Quantity{}, ErrNumeric
    			}
    			if result, ok := int64Multiply(value, int64(mantissa)); ok {
    				if !positive {
    					result = -result
    				}
    				// if the number is in canonical form, reuse the string
    				switch format {
    				case BinarySI:
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 23.8K bytes
    - Viewed (0)
Back to top