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.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store