From 26809f8ecacb826850602a62d8ba3962e85a1f70 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 13 Nov 2016 22:30:14 +1100 Subject: [PATCH] Memory: Use simpler math --- neofetch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 68903e55..4bee4234 100755 --- a/neofetch +++ b/neofetch @@ -1026,7 +1026,7 @@ get_memory() { ;; "Mac OS X" | "iPhone OS") - memtotal="$(($(sysctl -n hw.memsize) / 1024 / 1024))" + memtotal="$(($(sysctl -n hw.memsize) / 1024^2))" memwired="$(vm_stat | awk '/wired/ { print $4 }')" memactive="$(vm_stat | awk '/active / { printf $3 }')" memcompressed="$(vm_stat | awk '/occupied/ { printf $5 }')" @@ -1037,12 +1037,12 @@ get_memory() { case "$distro" in "NetBSD"*) memfree="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))" - memtotal="$(($(sysctl -n hw.physmem64) / 1024 / 1024))" + memtotal="$(($(sysctl -n hw.physmem64) / 1024^2))" ;; *) memfree="$(($(vmstat | awk 'END{printf $5}') / 1024))" - memtotal="$(($(sysctl -n hw.physmem) / 1024 / 1024))" + memtotal="$(($(sysctl -n hw.physmem) / 1024^2))" ;; esac @@ -1059,9 +1059,9 @@ get_memory() { ;; "Haiku") - memtotal="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024 / 1024))" + memtotal="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024^2))" memused="$(sysinfo -mem | awk -F '\\/|)' '{print $2; exit}')" - memused="$((${memused/max} / 1024 / 1024))" + memused="$((${memused/max} / 1024^2))" ;; esac memory="${memused}MB / ${memtotal}MB"