1 # ifndef CPPAD_LOCAL_HASH_CODE_HPP
2 # define CPPAD_LOCAL_HASH_CODE_HPP
21 namespace CppAD {
namespace local {
44 template <
class Value>
47 std::numeric_limits<unsigned short>::max()
54 const unsigned short* v
55 =
reinterpret_cast<const unsigned short*
>(& value);
57 size_t i =
sizeof(value) / 2 - 1;
64 unsigned short code =
static_cast<unsigned short>(
121 template <
class Base>
128 std::numeric_limits<unsigned short>::max()
136 unsigned short op_fac =
static_cast<unsigned short> (
142 size_t short_addr_t =
sizeof(
addr_t) / 2;
145 size_t short_base =
sizeof(Base) / 2;
148 unsigned short code =
static_cast<unsigned short>(
149 static_cast<unsigned short>(op) * op_fac
154 const unsigned short* v;
169 v =
reinterpret_cast<const unsigned short*
>(par + arg[0]);
173 v =
reinterpret_cast<const unsigned short*
>(arg + 1);
191 v =
reinterpret_cast<const unsigned short*
>(arg + 0);
192 i = 2 * short_addr_t;
203 v =
reinterpret_cast<const unsigned short*
>(arg + 0);
207 v =
reinterpret_cast<const unsigned short*
>(par + arg[1]);
235 v =
reinterpret_cast<const unsigned short*
>(arg + 0);
CPPAD_TAPE_ADDR_TYPE addr_t
size_t NumArg(OpCode op)
Number of arguments for a specified operator.
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION Base Value(const AD< Base > &x)
unsigned short local_hash_code(const Value &value)
General purpose hash code for an arbitrary value.
OpCode
Type used to distinguish different AD< Base > atomic operations.
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
#define CPPAD_HASH_TABLE_SIZE
the codes retruned by hash_code are between zero and CPPAD_HASH_TABLE_SIZE minus one.