Calibrating gyro

Hey people im trying to get a gyro upp and running by making a code so i found a good referance in Joope brooking. But the gyro gets a drift and this is his solution, but in my mind his pitch/roll/yaw calculated it the avrege and not the offsett. Can annyone please tell me im wrong and why?

YMFC-3D_gyro.ino (5.52 KB)