address encoding and decoding