kernel.c (263393) | kernel.c (265740) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2012, 2014 by Delphix. All rights reserved. 24 * Copyright (c) 2013, Joyent, Inc. All rights reserved. |
|
23 */ 24 25#include <assert.h> 26#include <fcntl.h> 27#include <poll.h> 28#include <stdio.h> 29#include <stdlib.h> 30#include <string.h> --- 764 unchanged lines hidden (view full) --- 795{ 796 poll(0, 0, ticks * (1000 / hz)); 797} 798 799#if 0 800/* 801 * Find highest one bit set. 802 * Returns bit number + 1 of highest bit that is set, otherwise returns 0. | 25 */ 26 27#include <assert.h> 28#include <fcntl.h> 29#include <poll.h> 30#include <stdio.h> 31#include <stdlib.h> 32#include <string.h> --- 764 unchanged lines hidden (view full) --- 797{ 798 poll(0, 0, ticks * (1000 / hz)); 799} 800 801#if 0 802/* 803 * Find highest one bit set. 804 * Returns bit number + 1 of highest bit that is set, otherwise returns 0. |
803 * High order bit is 31 (or 63 in _LP64 kernel). | |
804 */ 805int | 805 */ 806int |
806highbit(ulong_t i) | 807highbit64(uint64_t i) |
807{ | 808{ |
808 register int h = 1; | 809 int h = 1; |
809 810 if (i == 0) 811 return (0); | 810 811 if (i == 0) 812 return (0); |
812#ifdef _LP64 813 if (i & 0xffffffff00000000ul) { | 813 if (i & 0xffffffff00000000ULL) { |
814 h += 32; i >>= 32; 815 } | 814 h += 32; i >>= 32; 815 } |
816#endif | |
817 if (i & 0xffff0000) { 818 h += 16; i >>= 16; 819 } 820 if (i & 0xff00) { 821 h += 8; i >>= 8; 822 } 823 if (i & 0xf0) { 824 h += 4; i >>= 4; --- 350 unchanged lines hidden --- | 816 if (i & 0xffff0000) { 817 h += 16; i >>= 16; 818 } 819 if (i & 0xff00) { 820 h += 8; i >>= 8; 821 } 822 if (i & 0xf0) { 823 h += 4; i >>= 4; --- 350 unchanged lines hidden --- |