A normal 'unsigned long' on a Arduino Uno is 32 bit. You need two of them to store 64 bits.
You need another two to store the previous state (or last state).
When you are using the Due, the uint64_t can perhaps be used.
Or use a structure of 8 bytes with 64 bit fields.
I don't know if an array of 64 bit fields (and each element being just one bit) is possible. I have never tried that.
To compare the structure and to copy it to an other structure is possible with memcmp en memcpy.
I don't know which option is the best. It depends on your code and how you want to use the bits.
Do you have a few examples of other keyboard scanners ?
Koepel - I like your suggestion of using BitSet - etc.
I hadn't some across those before - and could be ideal.
Might be an alternative to using a mask to set the scan columns.
Koepel:
Do you have a few examples of other keyboard scanners ?
I have found one good example on the web - but it was for 32 keys, and I didn't like the way the code had been written. we all have our own ideals I suppose!
Ideally I will need an 8*12 matrix - to cover switches s well, so quite a lot of 'bits' to manipulate.