fixing linux luminance selction bug

ast_log2 didn't work as expected for linux - reimplementing it using
unions