68 karma · joined Sep 14, 2023 (3y ago) · 56 submissions
comment 5mo ago · link · parent
All this to say that Zig just keeps cleaning up and giving well-defined semantics to warts I learned to live with in C.
comment 5mo ago · link · parent
(2) fails for (x % 32 in [1, 2]) due to UB
(3) fails for x == 2
(4) crashes for x == 0
(5) is the same polynomial, only factorized
(6) always returns 0
(7) is the same polynomail reordered
But this works for any value of x:
x<2==2-x
or for something shorter: x<3&x>0
but that's not bery obfuscatedcomment 6mo ago · link · parent
He uses conditional moves and defines the number of iterations in advance to ellide the often mispredicted branch, and in the second article goes on to fix cache aliasing issues for large vectors using ternary search.
[1]: https://pvk.ca/Blog/2012/07/03/binary-search-star-eliminates...
[2]: https://pvk.ca/Blog/2012/07/30/binary-search-is-a-pathologic...
comment 8mo ago · link · parent
But I don't think the standard library maintainers would want to incorporate it considering the way in which the relicensing took place, the controversy, and the implications on software licences in general. So his motivations for the license change seem moot. I certainly wouldn't touch it with a 10-foot pole.
[1]: https://github.com/chardet/chardet/issues/36#issuecomment-76... [2]: https://github.com/chardet/chardet/issues/327#issuecomment-4... [3]: https://github.com/chardet/chardet/issues/327#issuecomment-4...
comment 8mo ago · link · parent
Meta's own guidelines[1] say that you should "Power off in private spaces."
You can't always tell if you're being recorded since they can be tampered with to disable the LED. And from what I gather, the LED only serves to indicate of video recording, and not necessarily audio.
comment 9mo ago · link · parent
comment 9mo ago · link · parent
openssl ,v
to expand to... openssl --version
readline seems like the way to go.Then again most of the examples OP gave are usually available as short options, and aliasing ,s to sudo is certainly possible. So the only one which makes sense to me is ,,=$. But it's probably not worth the trouble to my muscle memory.
comment 10mo ago · link · parent
enum (class)? [[nodiscard]] Error {
Ok,
NoMem,
...
};
[1]: https://en.cppreference.com/w/cpp/language/attributes/nodisc...comment 10mo ago · link · parent
There doesn't seem to be any way to set per-user group policies, so unless you're installing firefox in a user-controlled directory, it will require elevated privileges.
[1]: https://support.mozilla.org/en-US/kb/customizing-firefox-usi...
comment 1y ago · link · parent
comment 1y ago · link · parent
date -u --date='2038-01-19T03:14:08' +%s | perl -ne 'printf "%#x\n", $_'
It is also mentioned in perldoc Time::Piece [1], as a warning for people whose build of perl uses 32-bit integers for time.[1]: https://perldoc.perl.org/Time::Piece#Use-of-epoch-seconds
comment 1y ago · link · parent
comment 1y ago · link · parent
package main
import (
"sync"
"time"
)
type WaitGroup struct {
sync.WaitGroup
}
func (wg *WaitGroup) Go(fn func()) {
wg.Add(1)
go func() {
defer wg.Done()
fn()
}()
}
func main() {
var wg WaitGroup
wg.Go(func() { time.Sleep(1 * time.Second) })
wg.Wait()
}comment 1y ago · link · parent
[1]: https://danielchasehooper.com/posts/typechecked-generic-c-da...
comment 1y ago · link · parent
comment 1y ago · link · parent
> This page is a riff on Patrick Collison's list of /fast projects.
Maybe as a HN post, but the blog is in response to https://patrickcollison.com/fast