aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/hardware.rb15
-rw-r--r--Library/Homebrew/test/test_hardware.rb4
2 files changed, 15 insertions, 4 deletions
diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb
index c705c5e50..5447854a6 100644
--- a/Library/Homebrew/hardware.rb
+++ b/Library/Homebrew/hardware.rb
@@ -28,7 +28,11 @@ module Hardware
end
def type
- :dunno
+ case RUBY_PLATFORM
+ when /x86_64/, /i\d86/ then :intel
+ when /ppc\d+/ then :ppc
+ else :dunno
+ end
end
def family
@@ -40,7 +44,14 @@ module Hardware
end
def bits
- 64
+ case RUBY_PLATFORM
+ when /x86_64/, /ppc64/ then 64
+ when /i\d86/, /ppc/ then 32
+ end
+ end
+
+ def sse4?
+ RUBY_PLATFORM.to_s.include?("x86_64")
end
def is_32_bit?
diff --git a/Library/Homebrew/test/test_hardware.rb b/Library/Homebrew/test/test_hardware.rb
index d38c74df6..56d0980fa 100644
--- a/Library/Homebrew/test/test_hardware.rb
+++ b/Library/Homebrew/test/test_hardware.rb
@@ -3,11 +3,11 @@ require "hardware"
class HardwareTests < Homebrew::TestCase
def test_hardware_cpu_type
- assert_includes [:intel, :ppc], Hardware::CPU.type
+ assert_includes [:intel, :ppc, :dunno], Hardware::CPU.type
end
def test_hardware_intel_family
- families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake]
+ families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :dunno]
assert_includes families, Hardware::CPU.family
end if Hardware::CPU.intel?
end