From 6d0a9a164f2ca73f1303af9b5f7dcb07b5765c3f Mon Sep 17 00:00:00 2001 From: rnoland Date: Sat, 4 Oct 2008 14:45:34 +0000 Subject: Change drm_order() to use ffsl() pointed out by jhb@ Approved by: jhb (mentor) --- sys/dev/drm/drm_bufs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/drm/drm_bufs.c b/sys/dev/drm/drm_bufs.c index e5f6d1c..1457783 100644 --- a/sys/dev/drm/drm_bufs.c +++ b/sys/dev/drm/drm_bufs.c @@ -1102,11 +1102,12 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_order(unsigned long size) { 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; return order; -- cgit v1.1