Functions

Bitops.h File Reference

Utility functions for efficient bit operations. More...

#include "libts.h"
Include dependency graph for Bitops.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int ink_ffs (int n)
 Find First (bit) Set.
static int bitops_first_set (unsigned char *start, unsigned char *end, unsigned char **p)
 Returns the index of the first bit (least significant bit), set "1" for each char in the range (start end).
static int bitops_first_unset (unsigned char *start, unsigned char *end, unsigned char **p)
 Returns the index of the first bit (least significant bit), unset "0" for each char in the range (start end).
static int bitops_next_set (unsigned char *start, unsigned char *end, int offset)
 Returns the index of the first bit (least significant bit), set "1" for each char in the range (start end).
static int bitops_next_unset (unsigned char *start, unsigned char *end, int offset)
static int bitops_count (unsigned char *start, unsigned char *end)
static void bitops_union (unsigned char *s1, unsigned char *s2, int len)
static unsigned char bitops_set (unsigned char val, int bit)
static void bitops_set (unsigned char *val, int bit)
static unsigned char bitops_unset (unsigned char val, int bit)
static void bitops_unset (unsigned char *val, int bit)
static int bitops_isset (unsigned char val, int bit)
static int bitops_isset (unsigned char *val, int bit)

Detailed Description

Utility functions for efficient bit operations.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file Bitops.h.


Function Documentation

static int bitops_count ( unsigned char *  start,
unsigned char *  end 
) [inline, static]

Definition at line 204 of file Bitops.h.

References bit_count_table.

static int bitops_first_set ( unsigned char *  start,
unsigned char *  end,
unsigned char **  p 
) [inline, static]

Returns the index of the first bit (least significant bit), set "1" for each char in the range (start end).

Parameters:
start pointer to the first character.
end pointer to the location after the last character.
p (if not null) returns the location of the first char that has a bit set.
Returns:
index of the first bit set in the first character that has a bit turned on. Zero if all bits are zero.

Definition at line 53 of file Bitops.h.

References bit_table.

static int bitops_first_unset ( unsigned char *  start,
unsigned char *  end,
unsigned char **  p 
) [inline, static]

Returns the index of the first bit (least significant bit), unset "0" for each char in the range (start end).

Parameters:
start pointer to the first character.
end pointer to the location after the last character.
p (if not null) returns the location of the first char that has a bit unset.
Returns:
index of the first bit set in the first character that has a bit turned off. Zero if all bits are 1.

Definition at line 88 of file Bitops.h.

References bit_table.

static int bitops_isset ( unsigned char  val,
int  bit 
) [inline, static]

Definition at line 261 of file Bitops.h.

static int bitops_isset ( unsigned char *  val,
int  bit 
) [inline, static]

Definition at line 267 of file Bitops.h.

static int bitops_next_set ( unsigned char *  start,
unsigned char *  end,
int  offset 
) [inline, static]

Returns the index of the first bit (least significant bit), set "1" for each char in the range (start end).

Parameters:
start pointer to the first character.
end pointer to the location after the last character.
offset 
Returns:
index of the first bit set in the first character that has a bit turned on. Zero if all bits are zero.

Definition at line 122 of file Bitops.h.

References bit_table.

static int bitops_next_unset ( unsigned char *  start,
unsigned char *  end,
int  offset 
) [inline, static]

Definition at line 163 of file Bitops.h.

References bit_table.

static unsigned char bitops_set ( unsigned char  val,
int  bit 
) [inline, static]

Definition at line 233 of file Bitops.h.

static void bitops_set ( unsigned char *  val,
int  bit 
) [inline, static]

Definition at line 239 of file Bitops.h.

static void bitops_union ( unsigned char *  s1,
unsigned char *  s2,
int  len 
) [inline, static]

Definition at line 219 of file Bitops.h.

static void bitops_unset ( unsigned char *  val,
int  bit 
) [inline, static]

Definition at line 253 of file Bitops.h.

static unsigned char bitops_unset ( unsigned char  val,
int  bit 
) [inline, static]

Definition at line 247 of file Bitops.h.

static int ink_ffs ( int  n  )  [inline, static]

Find First (bit) Set.

Index starts at 1.

Returns:
zero for zero arg.

Definition at line 35 of file Bitops.h.