Skip to content

Commit

Permalink
misc: prepare for const ( deprecation (in util-vinix/)
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Aug 10, 2024
1 parent 5745194 commit 077bb7a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 68 deletions.
8 changes: 3 additions & 5 deletions util-vinix/fetch/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import os
fn C.getlogin() charptr
fn C.gethostname(name charptr, len u64) int

const (
escape_cyan = '\e[1;36m'
escape_blue = '\e[1;34m'
escape_reset = '\e[0m'
)
const escape_cyan = '\e[1;36m'
const escape_blue = '\e[1;34m'
const escape_reset = '\e[0m'

fn main() {
mut idx := 1
Expand Down
124 changes: 61 additions & 63 deletions util-vinix/lscpu/cpu_x64.v
Original file line number Diff line number Diff line change
Expand Up @@ -287,70 +287,68 @@ pub fn get_cpu_info() ?CPUInfo {
}
}

const (
cpuid_feature_ecx_sse3 = 1 << 0
cpuid_feature_ecx_pclmul = 1 << 1
cpuid_feature_ecx_dtes64 = 1 << 2
cpuid_feature_ecx_monitor = 1 << 3
cpuid_feature_ecx_ds_cpl = 1 << 4
cpuid_feature_ecx_vmx = 1 << 5
cpuid_feature_ecx_smx = 1 << 6
cpuid_feature_ecx_est = 1 << 7
cpuid_feature_ecx_tm2 = 1 << 8
cpuid_feature_ecx_ssse3 = 1 << 9
cpuid_feature_ecx_cid = 1 << 10
cpuid_feature_ecx_sdbg = 1 << 11
cpuid_feature_ecx_fma = 1 << 12
cpuid_feature_ecx_cx16 = 1 << 13
cpuid_feature_ecx_xtpr = 1 << 14
cpuid_feature_ecx_pdcm = 1 << 15
cpuid_feature_ecx_pdid = 1 << 17
cpuid_feature_ecx_dca = 1 << 18
cpuid_feature_ecx_sse4_1 = 1 << 19
cpuid_feature_ecx_sse4_2 = 1 << 20
cpuid_feature_ecx_x2apic = 1 << 21
cpuid_feature_ecx_movbe = 1 << 22
cpuid_feature_ecx_popcnt = 1 << 23
cpuid_feature_ecx_tsc = 1 << 24
cpuid_feature_ecx_aes = 1 << 25
cpuid_feature_ecx_xsave = 1 << 26
cpuid_feature_ecx_osxsave = 1 << 27
cpuid_feature_ecx_avx = 1 << 28
cpuid_feature_ecx_f16c = 1 << 29
cpuid_feature_ecx_rdrand = 1 << 30
cpuid_feature_ecx_hypervisor = 1 << 31
const cpuid_feature_ecx_sse3 = 1 << 0
const cpuid_feature_ecx_pclmul = 1 << 1
const cpuid_feature_ecx_dtes64 = 1 << 2
const cpuid_feature_ecx_monitor = 1 << 3
const cpuid_feature_ecx_ds_cpl = 1 << 4
const cpuid_feature_ecx_vmx = 1 << 5
const cpuid_feature_ecx_smx = 1 << 6
const cpuid_feature_ecx_est = 1 << 7
const cpuid_feature_ecx_tm2 = 1 << 8
const cpuid_feature_ecx_ssse3 = 1 << 9
const cpuid_feature_ecx_cid = 1 << 10
const cpuid_feature_ecx_sdbg = 1 << 11
const cpuid_feature_ecx_fma = 1 << 12
const cpuid_feature_ecx_cx16 = 1 << 13
const cpuid_feature_ecx_xtpr = 1 << 14
const cpuid_feature_ecx_pdcm = 1 << 15
const cpuid_feature_ecx_pdid = 1 << 17
const cpuid_feature_ecx_dca = 1 << 18
const cpuid_feature_ecx_sse4_1 = 1 << 19
const cpuid_feature_ecx_sse4_2 = 1 << 20
const cpuid_feature_ecx_x2apic = 1 << 21
const cpuid_feature_ecx_movbe = 1 << 22
const cpuid_feature_ecx_popcnt = 1 << 23
const cpuid_feature_ecx_tsc = 1 << 24
const cpuid_feature_ecx_aes = 1 << 25
const cpuid_feature_ecx_xsave = 1 << 26
const cpuid_feature_ecx_osxsave = 1 << 27
const cpuid_feature_ecx_avx = 1 << 28
const cpuid_feature_ecx_f16c = 1 << 29
const cpuid_feature_ecx_rdrand = 1 << 30
const cpuid_feature_ecx_hypervisor = 1 << 31

cpuid_feature_edx_fpu = 1 << 0
cpuid_feature_edx_vme = 1 << 1
cpuid_feature_edx_de = 1 << 2
cpuid_feature_edx_pse = 1 << 3
cpuid_feature_edx_tsc = 1 << 4
cpuid_feature_edx_msr = 1 << 5
cpuid_feature_edx_pae = 1 << 6
cpuid_feature_edx_mce = 1 << 7
cpuid_feature_edx_cx8 = 1 << 8
cpuid_feature_edx_apic = 1 << 9
cpuid_feature_edx_sep = 1 << 11
cpuid_feature_edx_mtrr = 1 << 12
cpuid_feature_edx_pge = 1 << 13
cpuid_feature_edx_mca = 1 << 14
cpuid_feature_edx_cmov = 1 << 15
cpuid_feature_edx_pat = 1 << 16
cpuid_feature_edx_pse36 = 1 << 17
cpuid_feature_edx_psn = 1 << 18
cpuid_feature_edx_clflush = 1 << 19
cpuid_feature_edx_ds = 1 << 21
cpuid_feature_edx_acpi = 1 << 22
cpuid_feature_edx_mmx = 1 << 23
cpuid_feature_edx_fxmsr = 1 << 24
cpuid_feature_edx_sse = 1 << 25
cpuid_feature_edx_sse2 = 1 << 26
cpuid_feature_edx_ss = 1 << 27
cpuid_feature_edx_htt = 1 << 28
cpuid_feature_edx_tm = 1 << 29
cpuid_feature_edx_ia64 = 1 << 30
cpuid_feature_edx_pbe = 1 << 31
)
const cpuid_feature_edx_fpu = 1 << 0
const cpuid_feature_edx_vme = 1 << 1
const cpuid_feature_edx_de = 1 << 2
const cpuid_feature_edx_pse = 1 << 3
const cpuid_feature_edx_tsc = 1 << 4
const cpuid_feature_edx_msr = 1 << 5
const cpuid_feature_edx_pae = 1 << 6
const cpuid_feature_edx_mce = 1 << 7
const cpuid_feature_edx_cx8 = 1 << 8
const cpuid_feature_edx_apic = 1 << 9
const cpuid_feature_edx_sep = 1 << 11
const cpuid_feature_edx_mtrr = 1 << 12
const cpuid_feature_edx_pge = 1 << 13
const cpuid_feature_edx_mca = 1 << 14
const cpuid_feature_edx_cmov = 1 << 15
const cpuid_feature_edx_pat = 1 << 16
const cpuid_feature_edx_pse36 = 1 << 17
const cpuid_feature_edx_psn = 1 << 18
const cpuid_feature_edx_clflush = 1 << 19
const cpuid_feature_edx_ds = 1 << 21
const cpuid_feature_edx_acpi = 1 << 22
const cpuid_feature_edx_mmx = 1 << 23
const cpuid_feature_edx_fxmsr = 1 << 24
const cpuid_feature_edx_sse = 1 << 25
const cpuid_feature_edx_sse2 = 1 << 26
const cpuid_feature_edx_ss = 1 << 27
const cpuid_feature_edx_htt = 1 << 28
const cpuid_feature_edx_tm = 1 << 29
const cpuid_feature_edx_ia64 = 1 << 30
const cpuid_feature_edx_pbe = 1 << 31

fn cpuid(leaf u32, subleaf u32) (bool, u32, u32, u32, u32) {
mut cpuid_max := u32(0)
Expand Down

0 comments on commit 077bb7a

Please sign in to comment.