Print this page
4374 dn_free_ranges should use range_tree_t
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sparc/os/bitmap_arch.c
          +++ new/usr/src/uts/sparc/os/bitmap_arch.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27   26  
  28   27  /*
       28 + * Copyright (c) 2014 by Delphix. All rights reserved.
       29 + */
       30 +
       31 +/*
  29   32   * Architecture specific definition for bitmap related routines.
  30   33   * These may be implemented using ISA specific instructions.
  31   34   */
  32   35  #include <sys/bitmap.h>
  33   36  
  34   37  /*
       38 + * Find highest one bit set.
       39 + *      Returns bit number + 1 of highest bit that is set, otherwise returns 0.
       40 + */
       41 +int
       42 +highbit64(uint64_t i)
       43 +{
       44 +        int h = 1;
       45 +
       46 +        if (i == 0)
       47 +                return (0);
       48 +        if (i & 0xffffffff00000000ULL) {
       49 +                h += 32; i >>= 32;
       50 +        }
       51 +        if (i & 0xffff0000) {
       52 +                h += 16; i >>= 16;
       53 +        }
       54 +        if (i & 0xff00) {
       55 +                h += 8; i >>= 8;
       56 +        }
       57 +        if (i & 0xf0) {
       58 +                h += 4; i >>= 4;
       59 +        }
       60 +        if (i & 0xc) {
       61 +                h += 2; i >>= 2;
       62 +        }
       63 +        if (i & 0x2) {
       64 +                h += 1;
       65 +        }
       66 +        return (h);
       67 +}
       68 +
       69 +/*
  35   70   * Find highest one bit set.
  36   71   *      Returns bit number + 1 of highest bit that is set, otherwise returns 0.
  37   72   * High order bit is 31 (or 63 in _LP64 kernel).
  38   73   */
  39   74  int
  40   75  highbit(ulong_t i)
  41   76  {
  42   77          register int h = 1;
  43   78  
  44   79          if (i == 0)
↓ open down ↓ 59 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX