frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: Can someone make a CAS just checking last bit on x86/ARM please?

3•goofy_lemur•14h ago
Guys/gals, I was thinking about doing some work here and I noticed there's no operation that allows a atomic compare/exchange based on the last bit.

There should be an instruction that allows you to do an update of a 64 bit value only if the last bit is a 0.

The idea here is you would be able to swap pointer values atomically only if they were unlocked.

2^63 is such a huge number, it is sufficient to represent practically all the data in the universe. If we allowed an atomic compare exchange on the last bit, or something like check if the last bit is 0, allow the write, otherwise don't, it would make programming a lot easier.

Thanks!

Comments

Normal_gaussian•14h ago
You're going to have to give a much clearer set of examples and justifications. I've had to CAS on bit masks, but not enough that it would make sense to introduce a new operation for it. I just CAS and spin if it fails and the bitmask is still valid.
goofy_lemur•5h ago
all right, I am doing a sort of a copy-on-write thing here. So the idea is that I only want to update the pointer if the record it points to is "unlocked"
charleslmunger•1h ago
What hardware are you running on where the cost of a relaxed 64 bit load and a branch is significant compared to a (possibly contended) cas?

You could always use ldset on arm for this.

Tell HN: 2 years building a kids audio app as a solo dev – lessons learned

41•oliverjanssen•11h ago•27 comments

Ask HN: Does "Zapier for payment automation" exist?

6•PL_Venard•11h ago•8 comments

Ask HN: How are you automating your coding work?

54•manthangupta109•6h ago•63 comments

Ask HN: Do you have any evidence that agentic coding works?

400•terabytest•1d ago•410 comments

Tell HN: Claude session limits getting small

7•pragmaticalien8•7h ago•7 comments

How do you keep AI-generated applications consistent as they evolve over time?

5•RobertSerber•8h ago•0 comments

Ask HN: When does changing pricing models break user trust?

5•skicoachapp•3h ago•8 comments

1 in 35,385 US immigrants are in MN+criminal+undocumented

5•QuantumGood•1h ago•3 comments

Tell HN: Claude helped me maintain my old open source project

8•nergal•4h ago•2 comments

Ask HN: How locked down are your work machines?

12•donatj•6h ago•12 comments

Ask HN: Are you going to meetups/conferences?

5•carimura•9h ago•4 comments

Tell HN: Avoid Cerebras if you are a founder

25•remusomega•9h ago•13 comments

Tell HN: Amazon has deactivated my seller account

69•hacky_engineer•7h ago•71 comments

Tell HN: ChatGPT needs a persistent workspace layer

6•LostBeacon•4h ago•1 comments

Ask HN: What's your biggest challenge with context engineering for AI agents?

3•karpathunter•9h ago•0 comments

Ask HN: Is OBD-II telematics data more private than mobile app tracking?

3•insuranceguru•6h ago•1 comments

Ask HN: What are good resources to get familiar with AI code editors?

3•northfield27•11h ago•2 comments

Ask HN: What single AI tool/technique 10x'd your productivity last year?

4•laxmena•9h ago•6 comments

Ask HN: Can someone make a CAS just checking last bit on x86/ARM please?

3•goofy_lemur•14h ago•3 comments

Ask HN: Why does SOC 2 feel so hard for early-stage startups?

4•asdxrfx•11h ago•0 comments

Ask HN: What should I write about next? (CS student learning by writing)

3•Aditya_kachhawa•10h ago•2 comments

Ask HN: Revive a mostly dead Discord server

18•movedx•1d ago•28 comments

Tell HN: Bending Spoons laid off almost everybody at Vimeo yesterday

352•Daemon404•9h ago•330 comments

Ask HN: COBOL devs, how are AI coding affecting your work?

167•zkid18•2d ago•183 comments

Ask HN: Which common map projections make Greenland look smaller?

17•jimnotgym•1d ago•17 comments

Code review your plans and your implementation

3•mayassin•12h ago•0 comments

Ask HN: How do you keep system context from rotting over time?

15•kennethops•1d ago•21 comments

Ask HN: Which Matrix and Mastodon servers are you using and why?

5•fsflover•5h ago•2 comments

Ask HN: Is retreq / retspec a thing?

3•foobarbecue•13h ago•0 comments

Ask HN: How to introduce Claude Code to a team?

11•9dev•1d ago•4 comments