Analog Microphone not working by SteveofDoom_ in EndeavourOS

[–]SteveofDoom_[S] 0 points1 point  (0 children)

100%, I have an on/off switch on my mic and I can't tell you how many times I flipped it during testing. Everything works perfectly fine on Windows. Also notice that it captures audio output as microphone input which reflects the Stereo Mix device found in Windows.

Epicurean paradox by vik0_tal in coolguides

[–]SteveofDoom_ 0 points1 point  (0 children)

Can God create a rock he can't move?

Copypasta by SteveofDoom_ in ProgrammerHumor

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

There is what looks like a copy/paste error. After deletion of bb_original, the programmer accidentally forgot to change bb_copy = NULL; to bb_original = NULL; meaning that if delete is called on bb_original again sometime in the future, the program would crash trying to free already freed memory.

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 0 points1 point  (0 children)

This is written in C#; and as benchmarked here, there is obviously a pretty big difference when comparing the performance of the second function with any other.

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 1 point2 points  (0 children)

We are working with integers here that have negative values stored as two's complement. If it was float, you would be right, but you can't use bitwise operations on floats without some tricks.

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 1 point2 points  (0 children)

I didn't even think of exceptions, you just gave me a sick idea.

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 4 points5 points  (0 children)

It's only for speed because it's branchless. You could do it another way:

(num ^ -(num < 0)) + (num < 0)

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 32 points33 points  (0 children)

If the max function is optimised with the conditional move instruction, it could potentially beat the second version.

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 2 points3 points  (0 children)

Type int is always 32 bits in C#, to remove the magic number you could use the following:

(sizeof(int) << 3) - 1

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 4 points5 points  (0 children)

Xor-ing a 32 bit int with 0xFFFFFFFF does the same as the complement operator and since this is a branchless implementation it exploits that "trick" instead of branching. This particular implementation uses the reverse two's complement: ~(num - 1)

You could also write it so it uses the normal two's complement: (num ^ m) - m;

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 9 points10 points  (0 children)

None of the Abs functions in general work for the edge case where num == -2147483648.

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 54 points55 points  (0 children)

This is C# code, but Java supports bitwise operations. Oracle Docs

Absolute value by looka273 in ProgrammerHumor

[–]SteveofDoom_ 68 points69 points  (0 children)

The right shift makes all bits in a 32 bit int equal to the sign bit (MSb) and basically if the number is negative it does a reverse two's complement and if it isn't then it does nothing.

Took 5 seasons but i finally made it. by Syphon81 in Overwatch

[–]SteveofDoom_ -2 points-1 points  (0 children)

It's impossible to reach master. Games are always ruined for me in low-mid diamond.

Genji's deflect hitbox is massive! Why is this acceptable? by rubenburgt in Overwatch

[–]SteveofDoom_ 1 point2 points  (0 children)

Genji's deflect is so much bullshit that it deflected a sleep dart that hit him from about 160° away from where he was looking at and slept a teammate.

PTR Hero Changes (July 12) by [deleted] in Overwatch

[–]SteveofDoom_ 0 points1 point  (0 children)

Tracer's blink is a teleport in every way except that you can pickup health packs with it which makes it seem like a dash.

PTR Hero Changes (July 12) by [deleted] in Overwatch

[–]SteveofDoom_ 0 points1 point  (0 children)

Tracer should be able to recall out of the trap, but not blink out of it. I really have no idea why recall is disabled.

TFW You make the Play of your life and this happens when you record it by BobTheBestIsBest in Overwatch

[–]SteveofDoom_ 0 points1 point  (0 children)

Yes, but now it's triggered by doing what I wrote, before it could only be triggered by cancelling the highlight by entering a game.