Find first and last set bit of a long integer: Difference between revisions
Content deleted Content added
Line 303: | Line 303: | ||
public static int mssb_idx(int x) { |
public static int mssb_idx(int x) { |
||
return |
return Integer.SIZE - 1 - Integer.numberOfLeadingZeros(x); |
||
} |
} |
||
public static int mssb_idx(long x) { |
public static int mssb_idx(long x) { |
||
return |
return Long.SIZE - 1 - Long.numberOfLeadingZeros(x); |
||
} |
} |
||