CRC16 calculation for MODBUS RTU
CRC-16 is just a term that describes an algorithm. There are multiple implementations possible. They not only differ by the used polynomial but also by the initial value.

Your particular implementation uses the IBM CRC-16 polynomial.

Other Possible polynomials are for example:
x^16 + x^15 + x^2 + 1 (IBM)
x^16 + x^12 + x^5 + 1 (CCITT)
x^16 + x^10 + x^8 + x^7 + x^3 + 1 (DECT)
(there are more on wikipedia)

Actually you can take any primitive polynomial. (UPDATE: Not using a primitive polynomial will reduce the output space but is still going to work.) So you will have to find out which one you have to use and then know the initial value.

Assume you are right with the IBM polynomial then assume the initial value is 0xffff. You use the function as follows:

uint16_t crc = 0xffff; // the initial value
uint8_t a[]; // your data
crc = crc16_update(crc, a[0]);
crc = crc16_update(crc, a[1]);
…
crc = crc16_update(crc, a[n]);
// done
// crc now holds the value of the data stored in a