uint16_t leading_bit = 1 << 15;
int write_extension_and_fieldID(char** p_pos, char* p_end, uint16_t fieldID, char vendor_specific){	uint16_t uint16 = htons(fieldID);	// a uint16_t, where only the leftmost bit is set.	// needet for the vendor-Specific bit.	uint16_t leading_bit = 1 << 15;	if (p_end < ( *p_pos + sizeof(uint16_t)  ) ) {		fprintf(stderr, "error in write_unsigned16: buffer too small!\n");		return -1;	}	if(vendor_specific == VENDOR_SPECIFIC) {		uint16 = uint16 | leading_bit;	} else {		// make sure, the number does not contain a leading bit		uint16 = uint16 & (~leading_bit);	}	memcpy ( *p_pos, &uint16, sizeof(uint16_t) );	*p_pos += sizeof (uint16_t);	return 0;}