Convert Seagate SMART RAW values for attributes:
1 Raw_Read_Error_Rate
7 Seek_Error_Rate
195 ECC_On_the_Fly_Count
to actual errors. These values are known to display huge numbers, often leading to unnecessary worries or even panic. The RAW values however represent both an event count and the number of errors: IOW how many reads and how many errors during those. If we consider a hard drives does many read operations, the RAW SMART value will rapidly increase, so it’s quite normal to see huge numbers here.
Handles both decimal and hex values (hex values preceded by 0x, example 0xFE45E3).
More info here: https://www.disktuna.com/big-scary-raw-s-m-a-r-t-values-arent-always-bad-news/
function split(n) {
var lo = n >>> 0; // Get the lower 32 bits
var hi = (n / 2 ** 32) >>> 0; // Get the upper 32 bits
return [hi, lo];
}
The split() function can be optimized, particularly by avoiding the unnecessary padding with leading zeroes and directly handling the bit manipulation in a more efficient way. Since the goal is to treat the number as a 64-bit integer and split it into two 32-bit parts, JavaScript provides bitwise operators that can simplify this process.