Jason Knight
1 min readJan 4, 2021

--

Uhm... I've been programming for 40+ years... what the blazes makes two arrays of boolean "vectors"? Much less what TYPE of intersection? You're actually talking "and" -- but what about or and xor?

But yeah, a binary "and" of a integers is faster than arrays wasting a byte or more on each bit. That's kind of a given.

People who write assembly call them "flags".

Oh, and big tip? it's easier to state your bits in hex than it is decimal, since each digit lines up to 4 bits. Trying to keep track of it in decimal is just a nightmare. 0xAC and 0x35 is a lot easier than 172 and 53.

But that just stems from how dumbass arbitrary "eye cans haz tehn fingars" is for choosing a numbering system.

Your intersection routine also made me laugh with the if/else for nothing. The inputs are boolean so...

res.push (v1[i] && v1[2]);

Could replace your if/else and two seperate push.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

No responses yet