mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
runtime: simplify nr_cpus(), add a test for nr_jobs()
This commit is contained in:

committed by
GitHub

parent
fb4c3ff31a
commit
c60948e52e
@@ -14,13 +14,6 @@ fn C.sysconf(name int) i64
|
||||
fn C.GetCurrentProcessorNumber() u32
|
||||
//}
|
||||
|
||||
pub fn nr_cpus() int {
|
||||
$if windows {
|
||||
return nr_cpus_win()
|
||||
}
|
||||
return nr_cpus_nix()
|
||||
}
|
||||
|
||||
pub fn nr_jobs() int {
|
||||
mut cpus := nr_cpus()
|
||||
// allow for overrides, for example using `VJOBS=32 ./v test .`
|
||||
@@ -32,25 +25,21 @@ pub fn nr_jobs() int {
|
||||
}
|
||||
|
||||
pub fn is_32bit() bool {
|
||||
mut x := false
|
||||
$if x32 { x = true }
|
||||
return x
|
||||
$if x32 { return true }
|
||||
return false
|
||||
}
|
||||
|
||||
pub fn is_64bit() bool {
|
||||
mut x := false
|
||||
$if x64 { x = true }
|
||||
return x
|
||||
$if x64 { return true }
|
||||
return false
|
||||
}
|
||||
|
||||
pub fn is_little_endian() bool {
|
||||
mut x := false
|
||||
$if little_endian { x = true }
|
||||
return x
|
||||
$if little_endian { return true }
|
||||
return false
|
||||
}
|
||||
|
||||
pub fn is_big_endian() bool {
|
||||
mut x := false
|
||||
$if big_endian { x = true }
|
||||
return x
|
||||
$if big_endian { return true }
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user