Refactor MAVLink packet loss calculations

Was reading through it and it wasn't very clear, so I refactored it a bit and added comments.
Also replaced an expensive modulus operation with a super-fast bitwise-and.