Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

amdgpu/dc: use kernel ilog2 for log_2.

This should produce the same result.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dave Airlie and committed by
Alex Deucher
23d433fa 4ee67c71

+4 -11
-10
drivers/gpu/drm/amd/display/dc/basics/conversion.c
··· 102 102 matrix[i] = (uint16_t)reg_value; 103 103 } 104 104 } 105 - 106 - unsigned int log_2(unsigned int num) 107 - { 108 - unsigned int result = 0; 109 - 110 - while ((num >>= 1) != 0) 111 - result++; 112 - 113 - return result; 114 - }
+4 -1
drivers/gpu/drm/amd/display/dc/basics/conversion.h
··· 38 38 struct fixed31_32 *flt, 39 39 uint32_t buffer_size); 40 40 41 - unsigned int log_2(unsigned int num); 41 + static inline unsigned int log_2(unsigned int num) 42 + { 43 + return ilog2(num); 44 + } 42 45 43 46 #endif