[FreeBSD] Do a bit of optimization on drm_order()

main
Robert Noland 2008-10-03 13:56:50 -04:00
parent 81952c7dd1
commit 4c92abfa8d
1 changed files with 4 additions and 3 deletions

View File

@ -1099,11 +1099,12 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
int drm_order(unsigned long size) int drm_order(unsigned long size)
{ {
int order; int order;
unsigned long tmp;
for (order = 0, tmp = size; tmp >>= 1; ++order); if (size == 0)
return 0;
if (size & ~(1 << order)) order = ffsl(size) - 1;
if (size & ~(1ul << order))
++order; ++order;
return order; return order;