package spu

type ComponentSize struct {
	CPUNum uint32 // Number of CPUs
	MemGi  uint32 // Memory in GiB
}

// CompareComponentSize compares two component sizes based on CPU and memory.
// Returns:
//   - Positive value if component A is larger than component B
//   - Zero if components are equal in size
//   - Negative value if component A is smaller than component B
//
// Comparison prioritizes CPU count first, then memory if CPU counts are equal.
func CompareComponentSize(a, b *ComponentSize) int {
	// First compare CPU values (CPU has higher priority)
	if a.CPUNum != b.CPUNum {
		return int(a.CPUNum) - int(b.CPUNum)
	}

	// If CPU values are the same, compare memory values
	return int(a.MemGi) - int(b.MemGi)
}
