Navigation

Operators and Keywords

Function List:

C++ API

bitfcns.cc File Reference

#include "str-vec.h"
#include "quit.h"
#include "defun.h"
#include "error.h"
#include "ov.h"
#include "ov-uint64.h"
#include "ov-uint32.h"
#include "ov-uint16.h"
#include "ov-uint8.h"
#include "ov-int64.h"
#include "ov-int32.h"
#include "ov-int16.h"
#include "ov-int8.h"
#include "ov-scalar.h"
#include "ov-re-mat.h"
#include "ov-bool.h"

Include dependency graph for bitfcns.cc:


Defines

#define BITOPX(OP, FNAME, RET)
#define BITOP(OP, FNAME)
#define DO_BITSHIFT(T)
#define DO_UBITSHIFT(T, N)
#define DO_SBITSHIFT(T, N)

Functions

 DEFUN (bitand, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} bitand (@var{x}, @var{y})\n\ Return the bitwise AND of non-negative integers.\n\ @var{x}, @var{y} must be in the range [0,bitmax]\n\ @seealso{bitor, bitxor, bitset, bitget, bitcmp, bitshift, bitmax}\n\ @end deftypefn")
 DEFUN (bitor, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} bitor (@var{x}, @var{y})\n\ Return the bitwise OR of non-negative integers.\n\ @var{x}, @var{y} must be in the range [0,bitmax]\n\ @seealso{bitor, bitxor, bitset, bitget, bitcmp, bitshift, bitmax}\n\ @end deftypefn")
 DEFUN (bitxor, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} bitxor (@var{x}, @var{y})\n\ Return the bitwise XOR of non-negative integers.\n\ @var{x}, @var{y} must be in the range [0,bitmax]\n\ @seealso{bitand, bitor, bitset, bitget, bitcmp, bitshift, bitmax}\n\ @end deftypefn")
 DEFUN (bitshift, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} bitshift (@var{a}, @var{k})\n\ @deftypefnx {Built-in Function} {} bitshift (@var{a}, @var{k}, @var{n})\n\ Return a @var{k} bit shift of @var{n}-digit unsigned\n\ integers in @var{a}. A positive @var{k} leads to a left shift.\n\ A negative value to a right shift. If @var{n} is omitted it defaults\n\ to log2(bitmax)+1.\n\ @var{n} must be in the range [1,log2(bitmax)+1] usually [1,33]\n\ \n\ @example\n\ @group\n\ bitshift (eye (3), 1)\n\ @result{}\n\ @group\n\ 2 0 0\n\ 0 2 0\n\ 0 0 2\n\ @end group\n\ \n\ bitshift (10, [-2, -1, 0, 1, 2])\n\ @result{} 2 5 10 20 40\n\ @c FIXME -- restore this example when third arg is allowed to be an array.\n\ @c \n\ @c \n\ @c bitshift ([1, 10], 2, [3,4])\n\ @c @result{} 4 8\n\ @end group\n\ @end example\n\ @seealso{bitand, bitor, bitxor, bitset, bitget, bitcmp, bitmax}\n\ @end deftypefn")
 DEFUN (bitmax, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} bitmax ()\n\ Return the largest integer that can be represented as a floating point\n\ value. On IEEE-754 compatible systems, @code{bitmax} is @code{2^53 - 1}.\n\ @end deftypefn")
 DEFUN (intmax, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} intmax (@var{type})\n\ Return the largest integer that can be represented in an integer type.\n\ The variable @var{type} can be\n\ \n\ @table @code\n\ @item int8\n\ signed 8-bit integer.\n\ @item int16\n\ signed 16-bit integer.\n\ @item int32\n\ signed 32-bit integer.\n\ @item int64\n\ signed 64-bit integer.\n\ @item uint8\n\ unsigned 8-bit integer.\n\ @item uint16\n\ unsigned 16-bit integer.\n\ @item uint32\n\ unsigned 32-bit integer.\n\ @item uint64\n\ unsigned 64-bit integer.\n\ @end table\n\ \n\ The default for @var{type} is @code{uint32}.\n\ @seealso{intmin, bitmax}\n\ @end deftypefn")
 DEFUN (intmin, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} intmin (@var{type})\n\ Return the smallest integer that can be represented in an integer type.\n\ The variable @var{type} can be\n\ \n\ @table @code\n\ @item int8\n\ signed 8-bit integer.\n\ @item int16\n\ signed 16-bit integer.\n\ @item int32\n\ signed 32-bit integer.\n\ @item int64\n\ signed 64-bit integer.\n\ @item uint8\n\ unsigned 8-bit integer.\n\ @item uint16\n\ unsigned 16-bit integer.\n\ @item uint32\n\ unsigned 32-bit integer.\n\ @item uint64\n\ unsigned 64-bit integer.\n\ @end table\n\ \n\ The default for @var{type} is @code{uint32}.\n\ @seealso{intmax, bitmax}\n\ @end deftypefn")

Define Documentation

#define BITOP ( OP,
FNAME   ) 

#define BITOPX ( OP,
FNAME,
RET   ) 

#define DO_BITSHIFT ( T   ) 

#define DO_SBITSHIFT ( T,
 ) 

Value:

do \
    { \
      int bits_in_type = octave_ ## T :: nbits (); \
      T ## NDArray m = m_arg.T ## _array_value (); \
        octave_ ## T mask = octave_ ## T::max (); \
      if ((N) < bits_in_type) \
        mask = bitshift (mask, (N) - bits_in_type); \
      else if ((N) < 1) \
        mask = 0; \
      mask = mask | octave_ ## T :: min (); /* FIXME: 2's complement only? */ \
      DO_BITSHIFT (T); \
    } \
  while (0)

#define DO_UBITSHIFT ( T,
 ) 

Value:

do \
    { \
      int bits_in_type = octave_ ## T :: nbits (); \
      T ## NDArray m = m_arg.T ## _array_value (); \
        octave_ ## T mask = octave_ ## T::max (); \
      if ((N) < bits_in_type) \
        mask = bitshift (mask, (N) - bits_in_type); \
      else if ((N) < 1) \
        mask = 0; \
      DO_BITSHIFT (T); \
    } \
  while (0)


Function Documentation

DEFUN ( intmin  ,
args   
)

DEFUN ( intmax  ,
args   
)

DEFUN ( bitmax  ,
args   
)

DEFUN ( bitshift  ,
args   
)

DEFUN ( bitxor  ,
args   
)

DEFUN ( bitor  ,
args   
)

DEFUN ( bitand  ,
args   
)