improved calc_iclass_mac to work independant of size