#bitshifter
Explore tagged Tumblr posts
Text
introspection
348 notes
·
View notes
Text
ran into the issue of my program just kind of freezing up while doing a status update, found out that socket commands will just lock up the thread theyre running on indefinitely if they cant complete their operation (in this case, i forgor to connect the device to the network so it wasnt available). added a timeout, works like a charm!
#tütensuppe#now i just have to chunk the data differently and do some bitshifting#then register a control system address#then its ready to go!
0 notes
Text
'<< has lower precedence than +' feels like a prank. It feels like maybe the universe was in order once but a c++ developer wanted to use << for stream insertion so they changed the precedence retroactively for everything. i mean honestly when have you ever wanted (a+b) << c. a + (b << c) is basically the most classic thing one can do with bitshift
#'use | it has lower operation precedence than <<' yes but like.#also. <= has higher precedence than |??? cmon
57 notes
·
View notes
Text
last night i sat down to work on my PCNY project again and i realized that i somehow forgot to implement marking a pokemon as seen or caught in the pokedex into my save editing code, so i went to go do that. i forgot how exactly that data was stored in the save file though, so i had to look up documentation on that on bulbapedia, and also reference my first attempt at implementing the same thing in my trader code.
back when i made my trader, for some reason i was working with hexadecimal and binary with values represented as strings...? it was my first time working directly with hex and i remember trying to look up how to do so in javascript and getting information on parseInt() and whatnot, so i guess i just assumed i had to work with strings...? i don't know, don't ask, i don't remember. the code for that tool is a mess as a result and i'd love to go back and redo it sometime with my new save editing code in play (and then i want to add features like swapping mail...! but that'll be a long time from now, probably)
anyway on top of all these values being strings, i also didn't really have an understanding of bitwise operators, which was a problem because pokedex seen/caught data is stored in bit arrays. to mark a pokemon as seen or caught, you have to flip a specific bit corresponding to the pokemon's national dex number to 1. since i was already working with strings, and i didn't understand bitwise operators, my code for that... looked like this
it... it works, but. um. yeah
now i just calculate the byte offset and the positioning of the bit that needs to be flipped (i need bitPos for something else later which is why i have it as a separate variable instead of putting num % 8 into the bitFlip line) and shift 1 that many times to the left, and then i go to that byte in the save data and do a simple OR ( | ) operation on it and the bitshifted 1, and that's it.
something i previously wrote a whole function for simplified down to two lines of code pretty much. suffice to say i have a better understanding of this now
12 notes
·
View notes
Text
For quite literally no reason I modified my input system to use a 16 bit integer and binary.
It was pretty easy and a fun exercise, but on modern hardware there is truly no reason to do this.
Here is the logic, the INPUT_UP etc are just #defines for 1's and bitshifts to get 00000010 and 00000100 and so forth.
And if I want to check a parameter I just do
if (app.input & INPUT_UP)
#this post is sponsored by gscreenshot#the only good screenshot utility i could find#codeblr#programming#gamedev#c#studyblr
43 notes
·
View notes
Text
hmmm…so like in C++(20) I need to do two things right now. ok—I wrote this post and it turned out to be 4! (4. Not 4!. Thankfully.) C++ coding diary/questions/difficulties below:
The recursive function I’m working with is structurally the following:
void f(x) {
if(cond) {
successCode
} else {
code1; f(g(x));
if(cond2) { code2; f(h(x)) }
}
}
So, it can either call itself with different arguments—possibly twice, one after the other—or it can succeed.
The way it works, though, is by having code1 and code2 update entries in a global array. (In fact, code1 is simply a[something] = a[somethingElse], and code2 is simply a[something] = 1. cond2 is a[somethingElse] == 0.) So we do have to proceed sequentially to some extent.
Ideally, successCode initiates a possibly computationally intensive task on, say, one of my CPU cores, but spins that off and continues on with the recursive call. However, successCode needs to only spin that process off after it’s finished reading from that global array. (Maybe that part will be trivial.) Further, it needs to stall in the case too many of these processes have been spun off already, and wait for there to be an opening to start.
I’m wondering if std::thread has what I need for that.
2. one thing I’m doing which feels “bad” is: well, I need to have some local constants accessible to a recursive function. Right now I’m essentially just calling f(a, x) where a is unchanged across recursive calls and x changes. Does the compiler know how to handle this correctly…? Is there a better way? Like making a class or something? (I would typically just define this recursive function f(x) inside an outer function that took a as an argument, but you can’t do that directly in C++…)
3. another which feels bad is using this global array! I just need a block of memory whose length is fixed for the majority of the time, but which must be (rarely) grown. does a std::vector give me just as good performance as a really long array, I wonder? The main thing I’m doing is accessing and setting bits at a bunch of different indices, not inserting or growing…and it never grows too large, so maybe a long array is fine.
4. And that’s the other problem—I’m setting bits. that means I get to choose between:
a long (~100?) (and mostly empty most of the time) global array of bools (current, default choice)
the rumored-to-be-cursed std::vector<bool>, which is overridden to be space-efficient instead of a vector of bools—but at the cost of a bunch of its vector-ness! is it better? who knows! half the things on the manual page say “eh, we leave it up to the implementation to decide how or even whether to do this.”
a long and mostly empty most of the time bitset
a boost::dynamic_bitset, which is like a bitset but…dynamic…and I don’t know if that’s better. Like I said I don’t really need to grow it.
what if I just had as many unsigned ints as I needed and manipulated their bits with bitshifting somehow, as though the concatenation of the ints were my array. what then. would that be far worse?
The weird thing is that I don’t need space efficiency, but I do, on each success, need to transform (and alter) the content of this array (or whatever) into something which is space-efficient, but in a weird and bespoke way (I use the last 6 bits of bytes). that means im either constantly converting integer indices into (whichByte, whichBit) pairs and accessing/setting bit values in bytes at the result, or I’m doing one single translation of the whole array each successCode. hard for me to say which is more efficient without testing…but the second *seems* better somehow. but integer operations might be really fast. idk.
2 notes
·
View notes
Text
Notch cancela “Minecraft 2” poucos dias depois de anunciá-lo
Por Vinicius Torres Oliveira
Falei com os caras do escritório. Parece que estamos fazendo Levers and Chests! O ponto de virada foi o PC Gamer dizendo que parecia interessante. Sim, eu ainda amo o PC Gamer.
Notch se envolve em mais uma polêmica com Minecraft
Após vender a IP para a Microsoft pelo valor de US$ 2,5 bilhões, Notch fundou um novo estúdio, Bitshift Entertainment, para trabalhar em conceitos originais. Posteriormente, seu nome foi removido dos créditos do sandbox devido a declarações polêmicas.
Na internet, ele utilizou seu espaço para promover mensagens controversas, incluindo apologia a teorias de conspiração e ao culto QAnon. Além disso, o desenvolvedor teria atacado minorias de forma selvagem e esboçou comentários que não foram bem recebidos.
0 notes
Text
Weird... I have always heard and used "Garbage in, Garbage out" as an error handing strategy
If the input is bad, do you:
A: stop the program and report an error?
B: Do the actions wanted on the input and just output the data
For example, a function "Bitshift x to the right" I would expect to have a GIGO error handling.
Where the function "Multiple by 2 X times" I would expect to not finish the calculation and instead make an error if for example the number was too bit to store in the return value
These are the same operations. Only difference is the name! :D
And they need different error handling :3
Since these models aren't great at judging the validity of sources, they'll cite propaganda. Or satire.
So it's like humans, except people think it's an authority figure and are less critical of it.
Here's a very relevant concept from programming:
88 notes
·
View notes
Photo

Sooo excited I got to create some brand new art for this legendary 8-Bit chiptune classic by Bit Shifter ! This vinyl record release features a special die-cut jacket too! Snag one before it sells out at shiptoshoremedia.com! 👾🎶🔥
22 notes
·
View notes
Video
tumblr
NYC HT to Bit Shifter
43 notes
·
View notes
Text
that's just 2 bitshifts to the left and an xor! really it's all just bitwise operations
im doing bitwise operations
66 notes
·
View notes
Photo

I can't wait for our road trip to NJ for this Synthwave Retro Alternative Electronic music festival! See everyone who is going there!#synthwave #humanmusicfestival #QXT #graphicmercenary #newwarknj #musicfestival #music #retrowave #gost #dwtd #magicsword #deadastronauts #betamaxx #treyfey #therainwithin #boaconstructor #bitshifter #nightclub #teeel #streetfever #strngr #skeletonhands #aeonrings #hunterquinn #theencounter #andarugo (at QXT's (Official))
#treyfey#magicsword#nightclub#deadastronauts#teeel#bitshifter#musicfestival#betamaxx#andarugo#theencounter#newwarknj#therainwithin#music#retrowave#boaconstructor#strngr#hunterquinn#dwtd#graphicmercenary#synthwave#streetfever#humanmusicfestival#skeletonhands#aeonrings#gost#qxt
2 notes
·
View notes
Photo

15 notes
·
View notes
Text
ok so for personal reasons I need some of the dumbest, goofiest, most elaborate cutting-your-toast-with-a-chainsaw type ways to do elementary school arithmetic problems. the type of stuff we did to that "whats 48+7" poll
my first thought for calculating 104/8 is to convert into base 8, then bitshift one to the right and then convert back but I feel like thats too simple
so, hit me with your best shot at solving the following problems:
whats 156 + 25
what's 2*45 + 15
what's 104/8
33 notes
·
View notes
Text
Add Multiply and Bitshift is all I’ve ever needed 😜
Jokes aside, the gameboy processor doesn’t have division or modulo as a built in operation so unless you are okay with it being more expensive to do these things than you’d prefer, you gotta find weird shortcuts to them.
Terrible math fact for y’all today-
Most computer programs *cannot* or *do not* calculate trig functions. When it comes to trig functions, your computer can do fast, accurate, or supports a wide range of values. For most uses, fast is the priority and the way they do that is with an easy to calculate approximation of the cosine, sine, and tangent functions rather than their actual values.
Think of asking your calculator for pi and finding out it was always using 22/7 instead of like, a constant or a calculation.
I want to stress that for 99% of use cases this will never matter, but for me it was like finding out that Santa isn’t real
87 notes
·
View notes