diff options
| author | Misty De Meo | 2014-06-21 21:57:03 -0700 |
|---|---|---|
| committer | Misty De Meo | 2014-06-21 21:59:51 -0700 |
| commit | 7814aee7bea602b24ddf0a920b98836bdf5aa2b8 (patch) | |
| tree | f4d86ecf728f9723599b4456f34d0c270348360a /Library/Homebrew/os/linux/hardware.rb | |
| parent | e8c5ea5870cbd34d39c3a212c076d8b7eb2abe6d (diff) | |
| download | homebrew-7814aee7bea602b24ddf0a920b98836bdf5aa2b8.tar.bz2 | |
Hardware: add new .features method
This returns a list of symbols with the various CPU features supported
by the active hardware.
Diffstat (limited to 'Library/Homebrew/os/linux/hardware.rb')
| -rw-r--r-- | Library/Homebrew/os/linux/hardware.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/os/linux/hardware.rb b/Library/Homebrew/os/linux/hardware.rb index 84a13cc03..507639e3a 100644 --- a/Library/Homebrew/os/linux/hardware.rb +++ b/Library/Homebrew/os/linux/hardware.rb @@ -36,6 +36,12 @@ module LinuxCPUs @flags ||= cpuinfo[/^flags.*/, 0].split end + # Compatibility with Mac method, which returns lowercase symbols + # instead of strings + def features + @features ||= flags[1..-1].map(&:intern) + end + %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each { |flag| define_method(flag + "?") { flags.include? flag } } |
