There is no standard way to access the carry bit(s) of primitive operations in C.
You will either need to perform the shift in a larger data type:
uint16_t foo = ...;
uint32_t tmp = (uint32_t)foo << shift;
uint16_t result = (uint16_t)tmp;
uint16_t carry = (uint16_t)(tmp >> 16);
or by performing the opposite shift:
uint16_t result = foo << shift;
uint16_t carry = foo >> (16 - shift);
Note that this second method invokes undefined behaviour if shift == 0
, so you'd need to handle that case separately.