func: static struct curveType *curve_from_gamma(float gamma) struct curveType * curve ; int num_entries = 1 ; curve = malloc ( sizeof ( struct curveType ) + sizeof ( uInt16Number ) * num_entries ); if ( ! curve )  curve -> count = num_entries; curve -> data [ 0 ] = float_to_u8Fixed8Number ( gamma ); static uint16_t float_to_u8Fixed8Number(float a) if ( a > ( 255.f + 255.f / 256 ) )  if ( a < 0.f )  return floorf ( a * 256.f + .5f ) ; curve -> type = CURVE_TYPE; return curve ; 