Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

bitops.h File Reference

#include "string.h"

Include dependency graph for bitops.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define IS_BIT_SET(arr, bit_nb)
#define IS_BIT_CLEARED(arr, bit_nb)   (! IS_BIT_SET(arr, bit_nb))
#define RESET_BIT(arr, bit_nb)   (((unsigned char*) arr)[(bit_nb) >> 3] &= ~(((unsigned char) 1) << ((bit_nb) & 7)))
#define SET_BIT(arr, bit_nb)   (((unsigned char*) arr)[(bit_nb) >> 3] |= ((unsigned char) 1) << ((bit_nb) & 7))

Functions

void SET_ALL_BITS (unsigned char *arr, unsigned long nb_bits)
void RESET_ALL_BITS (unsigned char *arr, unsigned long nb_bits)


Define Documentation

#define IS_BIT_CLEARED arr,
bit_nb   )     (! IS_BIT_SET(arr, bit_nb))
 

Definition at line 13 of file bitops.h.

Referenced by MFTPSndAgent::fill_read_ahead_buf(), and MFTPSndAgent::send_data().

#define IS_BIT_SET arr,
bit_nb   ) 
 

Value:

(((unsigned char*) arr)[(bit_nb) >> 3] & \
    (((unsigned char) 1) << ((bit_nb) & 7)))

Definition at line 9 of file bitops.h.

#define RESET_BIT arr,
bit_nb   )     (((unsigned char*) arr)[(bit_nb) >> 3] &= ~(((unsigned char) 1) << ((bit_nb) & 7)))
 

Definition at line 16 of file bitops.h.

Referenced by MFTPSndAgent::send_data().

#define SET_BIT arr,
bit_nb   )     (((unsigned char*) arr)[(bit_nb) >> 3] |= ((unsigned char) 1) << ((bit_nb) & 7))
 

Definition at line 19 of file bitops.h.

Referenced by MFTPSndAgent::send_data().


Function Documentation

void RESET_ALL_BITS unsigned char *  arr,
unsigned long  nb_bits
[inline]
 

Definition at line 33 of file bitops.h.

Referenced by MFTPSndAgent::init_user_file(), and MFTPSndAgent::send_data().

00034 {
00035     memset(arr, 0, nb_bits >> 3);
00036     if(nb_bits & 7) {
00037         arr[nb_bits >> 3] &= ((unsigned char) 255) << (nb_bits & 7);
00038     }
00039 }

void SET_ALL_BITS unsigned char *  arr,
unsigned long  nb_bits
[inline]
 

Definition at line 24 of file bitops.h.

Referenced by MFTPSndAgent::init_user_file(), and MFTPSndAgent::send_data().

00025 {
00026     memset(arr, 255, nb_bits >> 3);
00027     if(nb_bits & 7) {
00028         arr[nb_bits >> 3] |= ((unsigned char) 255) >> (8 - (nb_bits & 7));
00029     }
00030 }


Generated on Tue Apr 20 12:15:48 2004 for NS2.26SourcesOriginal by doxygen 1.3.3