diff options
author | rnoland <rnoland@FreeBSD.org> | 2008-10-04 14:45:34 +0000 |
---|---|---|
committer | rnoland <rnoland@FreeBSD.org> | 2008-10-04 14:45:34 +0000 |
commit | 6d0a9a164f2ca73f1303af9b5f7dcb07b5765c3f (patch) | |
tree | 92109922106564f7e8273b1e27c04e8c6cd70d10 /sys | |
parent | b70d9c77175a44a23eaf1084cd74fb4ae7804067 (diff) | |
download | FreeBSD-src-6d0a9a164f2ca73f1303af9b5f7dcb07b5765c3f.zip FreeBSD-src-6d0a9a164f2ca73f1303af9b5f7dcb07b5765c3f.tar.gz |
Change drm_order() to use ffsl()
pointed out by jhb@
Approved by: jhb (mentor)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/drm/drm_bufs.c | 7 |
1 files changed, 4 insertions, 3 deletions
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; |