-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: calculate log2i properly #7567
Conversation
return 0 | ||
} | ||
|
||
return 63 - bits.LeadingZeros64(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the real fix, previous code was s/63/64
.
the code in systemd for comparison: https://github.com/systemd/systemd/blob/6639ac474eb7a5325a72a3d7370492792dd00bc0/src/fundamental/logarithm.h#L39-L40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on not needing to maintain all these constants
Fixes siderolabs#7080 The real bug was off-by-one in `log2i` implementation, other changes are cleanups as `x/sys/unix` package now contains all the constants we need. Signed-off-by: Andrey Smirnov <[email protected]>
one more PR coming to help debugging things |
/m |
This is a follow-up for siderolabs#7567, which won't be backported to 1.5. This allows to get an output like: ``` $ talosctl -n 172.20.0.5 get adjtimestatus -w NODE * NAMESPACE TYPE ID VERSION OFFSET ESTERROR MAXERROR STATUS SYNC 172.20.0.5 + runtime AdjtimeStatus node 47 -18.14306ms 0s 191.5ms STA_PLL | STA_NANO true 172.20.0.5 runtime AdjtimeStatus node 48 -17.109555ms 0s 206.5ms STA_NANO | STA_PLL true 172.20.0.5 runtime AdjtimeStatus node 49 -16.134923ms 0s 221.5ms STA_NANO | STA_PLL true 172.20.0.5 runtime AdjtimeStatus node 50 -15.21581ms 0s 236.5ms STA_PLL | STA_NANO true ``` Signed-off-by: Andrey Smirnov <[email protected]>
This is a follow-up for siderolabs#7567, which won't be backported to 1.5. This allows to get an output like: ``` $ talosctl -n 172.20.0.5 get adjtimestatus -w NODE * NAMESPACE TYPE ID VERSION OFFSET ESTERROR MAXERROR STATUS SYNC 172.20.0.5 + runtime AdjtimeStatus node 47 -18.14306ms 0s 191.5ms STA_PLL | STA_NANO true 172.20.0.5 runtime AdjtimeStatus node 48 -17.109555ms 0s 206.5ms STA_NANO | STA_PLL true 172.20.0.5 runtime AdjtimeStatus node 49 -16.134923ms 0s 221.5ms STA_NANO | STA_PLL true 172.20.0.5 runtime AdjtimeStatus node 50 -15.21581ms 0s 236.5ms STA_PLL | STA_NANO true ``` Signed-off-by: Andrey Smirnov <[email protected]>
Fixes #7080
The real bug was off-by-one in
log2i
implementation, other changes are cleanups asx/sys/unix
package now contains all the constants we need.