GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Functions
bitfcns.cc File Reference
#include <limits>
#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-float.h"
#include "ov-scalar.h"
#include "ov-re-mat.h"
#include "ov-bool.h"
#include <functional>
Include dependency graph for bitfcns.cc:

Go to the source code of this file.

Classes

struct  std::bit_and< T >
 
struct  std::bit_or< T >
 
struct  std::bit_xor< T >
 

Macros

#define DO_BITSHIFT(T)
 
#define DO_SBITSHIFT(T, N)
 
#define DO_UBITSHIFT(T, N)
 

Functions

octave_value bitop (const std::string &fname, const octave_value_list &args)
 
static int bitop_arg_is_bool (const octave_value &arg)
 
static int bitop_arg_is_float (const octave_value &arg)
 
static int bitop_arg_is_int (const octave_value &arg)
 
template<typename T >
octave_value bitopx (const std::string &fname, const Array< T > &x, const Array< T > &y)
 
template<typename OP , typename T >
octave_value bitopxx (const OP &op, const std::string &fname, const Array< T > &x, const Array< T > &y)
 
static int64_t bitshift (double a, int n, int64_t mask)
 
static int64_t bitshift (float a, int n, int64_t mask)
 
OCTAVE_EXPORT octave_value_list Fbitand (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fbitmax (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fbitor (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fbitshift (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fbitxor (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fflintmax (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fintmax (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fintmin (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fsizemax (const octave_value_list &args, int)
 
template<typename T >
static int64_t max_mantissa_value ()
 

Macro Definition Documentation

#define DO_BITSHIFT (   T)

Definition at line 464 of file bitfcns.cc.

Referenced by Fbitshift().

#define DO_SBITSHIFT (   T,
  N 
)
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? */ \
} \
while (0)
static int64_t bitshift(double a, int n, int64_t mask)
Definition: bitfcns.cc:431
#define DO_BITSHIFT(T)
Definition: bitfcns.cc:464
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:233
F77_RET_T const octave_idx_type & N
Definition: CmplxGEPBAL.cc:39
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:210

Definition at line 526 of file bitfcns.cc.

Referenced by Fbitshift().

#define DO_UBITSHIFT (   T,
  N 
)
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; \
} \
while (0)
static int64_t bitshift(double a, int n, int64_t mask)
Definition: bitfcns.cc:431
#define DO_BITSHIFT(T)
Definition: bitfcns.cc:464
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:233
F77_RET_T const octave_idx_type & N
Definition: CmplxGEPBAL.cc:39

Definition at line 512 of file bitfcns.cc.

Referenced by Fbitshift().

Function Documentation

octave_value bitop ( const std::string &  fname,
const octave_value_list args 
)
static int bitop_arg_is_bool ( const octave_value arg)
inlinestatic

Definition at line 143 of file bitfcns.cc.

References octave_value::class_name(), and octave_bool::static_class_name().

Referenced by bitop().

static int bitop_arg_is_float ( const octave_value arg)
inlinestatic

Definition at line 149 of file bitfcns.cc.

References octave_value::class_name(), and octave_float_scalar::static_class_name().

Referenced by bitop().

static int bitop_arg_is_int ( const octave_value arg)
inlinestatic
template<typename T >
octave_value bitopx ( const std::string &  fname,
const Array< T > &  x,
const Array< T > &  y 
)

Definition at line 123 of file bitfcns.cc.

References bitopxx().

Referenced by bitop().

template<typename OP , typename T >
octave_value bitopxx ( const OP &  op,
const std::string &  fname,
const Array< T > &  x,
const Array< T > &  y 
)

Definition at line 78 of file bitfcns.cc.

References Array< T >::dims(), error(), Array< T >::numel(), Array< T >::resize(), and x.

Referenced by bitopx().

static int64_t bitshift ( double  a,
int  n,
int64_t  mask 
)
static

Definition at line 431 of file bitfcns.cc.

Referenced by bitshift().

static int64_t bitshift ( float  a,
int  n,
int64_t  mask 
)
static

Definition at line 446 of file bitfcns.cc.

References bitshift().

OCTAVE_EXPORT octave_value_list Fbitand ( const octave_value_list args,
int   
)

Definition at line 373 of file bitfcns.cc.

References bitop().

OCTAVE_EXPORT octave_value_list Fbitmax ( const octave_value_list args,
int   
)

Definition at line 694 of file bitfcns.cc.

References error(), octave_value::length(), and print_usage().

OCTAVE_EXPORT octave_value_list Fbitor ( const octave_value_list args,
int   
)

Definition at line 385 of file bitfcns.cc.

References bitop().

OCTAVE_EXPORT octave_value_list Fbitshift ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fbitxor ( const octave_value_list args,
int   
)

Definition at line 397 of file bitfcns.cc.

References bitop().

OCTAVE_EXPORT octave_value_list Fflintmax ( const octave_value_list args,
int   
)

Definition at line 730 of file bitfcns.cc.

References error(), octave_value::length(), and print_usage().

OCTAVE_EXPORT octave_value_list Fintmax ( const octave_value_list args,
int   
)

Definition at line 789 of file bitfcns.cc.

References error(), octave_value::length(), max(), and print_usage().

OCTAVE_EXPORT octave_value_list Fintmin ( const octave_value_list args,
int   
)

Definition at line 860 of file bitfcns.cc.

References error(), octave_value::length(), min(), and print_usage().

OCTAVE_EXPORT octave_value_list Fsizemax ( const octave_value_list args,
int   
)

Definition at line 906 of file bitfcns.cc.

References dim_vector::dim_max(), and print_usage().

template<typename T >
static int64_t max_mantissa_value ( )
static

Definition at line 425 of file bitfcns.cc.