From 2476801613a293d7810c5faf2e3383a653b1389c Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Sun, 17 Mar 2013 13:30:12 -0500 Subject: Hardware: separate out CPU values into CPU module * CPU functions now exist in Hardware::CPU * Added compatibility functions in compat/hardware_compat.rb * Names are less specific to Mac hardware, e.g. CPU.family instead of Hardware.intel_family * Hardware::CPU.family works for both Intel and PowerPC * New helper methods on CPU, like .sse4? and .altivec? Signed-off-by: Misty De Meo --- Library/Homebrew/compat/hardware_compat.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Library/Homebrew/compat/hardware_compat.rb (limited to 'Library/Homebrew/compat') diff --git a/Library/Homebrew/compat/hardware_compat.rb b/Library/Homebrew/compat/hardware_compat.rb new file mode 100644 index 000000000..550c10118 --- /dev/null +++ b/Library/Homebrew/compat/hardware_compat.rb @@ -0,0 +1,29 @@ +class Hardware + class << self + def is_32_bit? + not CPU.is_64_bit? + end + + def is_64_bit? + CPU.is_64_bit? + end + + def bits + Hardware::CPU.bits + end + + def cpu_type + Hardware::CPU.type + end + + def cpu_family + Hardware::CPU.family + end + alias_method :intel_family, :cpu_family + alias_method :ppc_family, :cpu_family + + def processor_count + Hardware::CPU.cores + end + end +end -- cgit v1.2.3