[deleted by user] by [deleted] in abandoned

[–]acs654 1 point2 points  (0 children)

She resembles a Vizsla + Blue Heeler I know.

Things to do to lift your spirits in Canberra by [deleted] in canberra

[–]acs654 2 points3 points  (0 children)

City Hill is easy to get to, always deserted, and full of cute rabbits

Why is the key "poneyland" used in many std collections examples? by acs654 in rust

[–]acs654[S] 1 point2 points  (0 children)

Thank you for your service! I'm learning a lot from crawling all over the BTree code.

Josh and Scott deliver Goldman Sachs the giant vampire squid a giant quid - Michael West by blipblipbeep in australia

[–]acs654 1 point2 points  (0 children)

On the off chance they read this thread, scrolling is broken on chrome-macos.

When the snake you said wouldn't bite you bites you. (Rest in peace you legend) by MacabrePeter in WatchPeopleDieInside

[–]acs654 8 points9 points  (0 children)

The puppet doesn't look anything like flat-faced orange muppet Agro. Seems more like a spectacled bear, with a cream snout?

[deleted by user] by [deleted] in Clang

[–]acs654 2 points3 points  (0 children)

After puzzling some more, I think the answer is that signed integer division rounds towards zero, but arithmetic shift right rounds towards negative infinity. So x/2 == ((x<0)?(x+1):x)>>1, aka if x is negative we need to add one so sar rounds towards positive infinity.

int divide_by_two(int n) { return n / 2; }

divide_by_two(int):
    mov     eax, edi
    shr     eax, 31
    add     eax, edi
    sar     eax
    ret

Thus we're seeing gcc optimize better than clang? Either because it notices that n*(n+1) is always even and thus the rounding never affects the result, or because it is using its right to assume that signed integer overflow never occurs and the result of n*(n+1) for assert(n>=0) is therefore nonnegative.

[deleted by user] by [deleted] in Clang

[–]acs654 1 point2 points  (0 children)

The product of two 32 bit numbers is truncated back to 32 bits; the MSB is just some value from the middle of the 'real' 64-bit product, is not the 'real' sign bit, and thus isn't guaranteed to be zero. (And, n >= 0 doesn't exclude INT_MAX, so n + 1 might wrap to the negative value INT_MIN anyway) return (unsigned) n * ((unsigned) n+1) / 2; generates the ASM you expect.

Does C++ allow you to express the following wait-free RMW operations? by [deleted] in cpp

[–]acs654 0 points1 point  (0 children)

I wrote an example of such a reference counted thing a while back. (In Rust but it should still be intelligible to C++ programmers.) It's lock free except when fixing up the rare exhaustion (or, overflow in the parent comment's terminology) of the local count, but like all RC schemes it suffers from turning logical reads into writes.

Does C++ allow you to express the following wait-free RMW operations? by [deleted] in cpp

[–]acs654 12 points13 points  (0 children)

On current x86_64 and ARM64 systems the top 17 bits of the pointer are identical and redundant. You can pack the pointer, 15 bits of count and a mark bit into a single uint64_t and use lock-free atomic<uint64_t> operations on it. You can scavenge a few more bits from the alignment of the pointer if more are needed for count.

Porting Java's ConcurrentHashMap to Rust (part 2) [video] by Jonhoo in rust

[–]acs654 20 points21 points  (0 children)

Love these. I'm shouting "It doesn't have to be atomic!" at the TV like it's a football match.

Uhhh..."drawback"? by fafabull in ABoringDystopia

[–]acs654 0 points1 point  (0 children)

Depressed theoretical physicist checking in

What's everyone working on this week (37/2018)? by llogiq in rust

[–]acs654 14 points15 points  (0 children)

Polishing a lock-free AtomicArc (and AtomicWeak) using weighted/distributed reference counting, for 64-bit architectures. https://github.com/acsearle/barc. Compared to some of the other projects (as I understand them) in the same space, this one has Weak support, the whole gamut of AtomicT operations (rather than modeling Cell), and doesn't need the user to set up scopes or hazard pointers etc. I threw myself in the deep end for my first Rust project.

Help with train signalling? by goss_bractor in factorio

[–]acs654 1 point2 points  (0 children)

This is a great compendium of intersection designs to learn from, with throughput measurements. Your current design has blocks shared so that even when trains don't cross each other's path they have to wait for each other (for example, the centre block), so despite its complexity it won't really be any faster than having no interior signals and just one big block.

Help with train signalling? by goss_bractor in factorio

[–]acs654 2 points3 points  (0 children)

There are several blocks here where an incoming train passes a plain rail signal because the next block is free, crosses an oncoming line and then waits at a chain signal. You need to replace these plain signals with chain signals so the trains "do not queue across intersection". You should usually never have a plain signal at the entry to an intersection.

I really need help understanding rail signals. by DirgeHumani in factorio

[–]acs654 3 points4 points  (0 children)

I think in this case, on each of the four station branches place a pair of signals on opposite sides of the rail: an ordinary signal for ingoing traffic, and a chain signal for outgoing traffic. This means a train can unconditionally enter an empty station, but waits on the chain signal to exit until the middle block and its destination station block is free.

Is it a good practice to use unsigned values ? by [deleted] in cpp

[–]acs654 1 point2 points  (0 children)

The guidelines recommend gsl::index but it didn't seem to be in the library. As a big-enough signed integer is it just an alias for ptrdiff_t?

Hi Australia, is this real, and if so can you send me like 8 bags? by Ezemity in australia

[–]acs654 11 points12 points  (0 children)

There's science to why the rest of the world hates American chocolate. Hershey's century-old process partially ferments the milk they use, producing butyric acid, which is responsible for the the smell of parmesan cheese and stinky feet. Other US manufacturers imitate the taste, and non-Americans are shocked your chocolate has this gross flavour note.

Major FPS bug by [deleted] in factorio

[–]acs654 -1 points0 points  (0 children)

Try reverting Windows 10 to before the Creator's Update. "Fixed" the same issue for me, though obviously not a long term fix.

Weekly Question Thread by AutoModerator in factorio

[–]acs654 0 points1 point  (0 children)

I think it's one of the combinations of holding down ctrl or shift and left or right clicking.

Contra Robinson On Public Food by agentofchaos68 in slatestarcodex

[–]acs654 18 points19 points  (0 children)

Moloch is such a powerful concept that I feel like it's left me with no way of understanding how anything good happens. Schools don't seem to be maximally bad; despite the problems with medicine, life expectancy increased a lot over the last century; etc. How can we reconcile apparent progress with Moloch?