#combinator bitshift complaining

1 messages · Page 1 of 1 (latest)

chrome mural
#

I will hide you!

pliant sleet
#

I cannot be hidden!

chrome mural
#

youve fallen into my trap

pliant sleet
#

probably should be renamed to "combinator bitshift complaining"

#

or "combinator bitshift schenanigannery"

#

"tomfoolery"

chrome mural
#

combinator bitshift complaining

deep summit
#

(In fact the bit shift defined on integers is not one but multiple different groups)

pliant sleet
#

what's wrong with computer scientists

#

couldn't they just define something and make that thing a thing

deep summit
#

Hi, computer scientist here.

#

I can answer the question.

pliant sleet
#

(but there's 20 different ways to answer it with varying pros and cons)

#

which one has the O(1) memory complexity, I'll take it

deep summit
#

They all do.

#

THAT'S THE PROBLEM.

#

Basic bit shifting exists pretty much exclusively for serial communication. You're just... moving bits through a register and reading off the last one.

dusty hornet
#

new mod idea: nasal demons

#

shifting by less than 0 or at least 32 places causes your combinator to explode because of the undefined behavior

deep summit
#

Arithmetic bit shifting exists because -2 >> 1 should be -(2 >> 1) and under 2c that means the highest order bit needs to be preserved.

#

Carry shift exists because sometimes you're working with bigger numbers so you need to carry in from the next byte up.

#

Cycle shifting exists because otherwise you need two instructions, one to grab the lowest order bit, and one to carry-in shift everything else.

#

What's interesting.

#

Is that the result of (1 << -1) << 1 is undefined.

pliant sleet
#

@deep summit if it was always arithmetic bitshifting, 1 << 31 would be 0, not 1 - 2 ^ 32.

#

damn you kovarex

deep summit
#

This is a cycle, methinks.

#

1 << 32 = 1

#

But 1 >> 32 also = 1

deep summit
# pliant sleet damn you kovarex

Honestly, my Kovarex solution is just to not output 238 unless there's more than enough for two or three reactors in a chest already.

#

I tried doing the counter thing.

#

I really did.

pliant sleet
#

you're pulling my leg right

deep summit
#

I am not.

pliant sleet
#

kovarex is the head dev of factorio

deep summit
#

Oh.

pliant sleet
#

that's why it's called kovarex enrichment

deep summit
#

is ignorant to these things.

pliant sleet
#

that's alright

deep summit
#

My usual operating mode is, see game, play game, neuron activation, happy chemicals.

#

But yeah I encountered the bitshift fuckery earlier today with my prior posting.

#

Was trying to work out how to make a digital display that only showed necessary digits.

#

Next challenge: negatives.

pliant sleet
#

have fun

vernal depot
#

This is a classic programmer argument. Complain about undefined behavior, while specifying that your specific undefined behavior is correct. I literally just did the same thing regarding markdown parsers. in #programming chat.

deep summit
#

Honestly, I wish we had the logarithm combinator.

deep summit
#

I just realized.

#

We can make alphabetic or numeric displays.

#

But we can't make an alphanumeric one because that needs at least 36 bits to encode.

dusty hornet
#

use an encoding flag?

deep summit
#

We only have 32 bits of space.

#

Wait.

#

Misread that.

dusty hornet
#

X > 0: number
X < 0: letter

#

(or some other bit, that's just the easiest to check)

deep summit
#

I guess, but at its logical extreme it becomes purely a mapping.

#

Hol' up a moment.

#

Alright so, theory.

#

Combinator for each segment.

#

Wait, no, hold on.

#

All the possible combinations for a 7-segment can be encoded within 7 bits.

#

If we want to go into logical extremes we can have a decoder unit that dumps combinations onto a bus, which each individual digit consumes.

#

In theory we can abuse the rather large number of symbols available to make a grid sort of deal.

#

In layman's terms, 2^32 possible input values, 2^(whatever the number of distinct symbols there are) choices from those input values.