Lines 125-137
struct signConverter
Link Here
|
125 |
static const int kScaleBits = (Format + 1) * CHAR_BIT - 1; |
125 |
static const int kScaleBits = (Format + 1) * CHAR_BIT - 1; |
126 |
static const int kMinSignedValue = -1 << kScaleBits; |
126 |
static const int kMinSignedValue = -1 << kScaleBits; |
127 |
|
127 |
|
128 |
struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType> |
128 |
struct signedToUnsigned |
129 |
{ |
129 |
{ |
|
|
130 |
typedef SignedType argument_type; |
131 |
typedef UnsignedType result_type; |
130 |
UnsignedType operator()(SignedType x) { return x - kMinSignedValue; } |
132 |
UnsignedType operator()(SignedType x) { return x - kMinSignedValue; } |
131 |
}; |
133 |
}; |
132 |
|
134 |
|
133 |
struct unsignedToSigned : public std::unary_function<SignedType, UnsignedType> |
135 |
struct unsignedToSigned |
134 |
{ |
136 |
{ |
|
|
137 |
typedef SignedType argument_type; |
138 |
typedef UnsignedType result_type; |
135 |
SignedType operator()(UnsignedType x) { return x + kMinSignedValue; } |
139 |
SignedType operator()(UnsignedType x) { return x + kMinSignedValue; } |
136 |
}; |
140 |
}; |
137 |
}; |
141 |
}; |
Lines 323-330
private:
Link Here
|
323 |
}; |
327 |
}; |
324 |
|
328 |
|
325 |
template <typename Arg, typename Result> |
329 |
template <typename Arg, typename Result> |
326 |
struct intToFloat : public std::unary_function<Arg, Result> |
330 |
struct intToFloat |
327 |
{ |
331 |
{ |
|
|
332 |
typedef Arg argument_type; |
333 |
typedef Result result_type; |
328 |
Result operator()(Arg x) const { return x; } |
334 |
Result operator()(Arg x) const { return x; } |
329 |
}; |
335 |
}; |
330 |
|
336 |
|
Lines 389-402
private:
Link Here
|
389 |
}; |
395 |
}; |
390 |
|
396 |
|
391 |
template <typename Arg, typename Result, unsigned shift> |
397 |
template <typename Arg, typename Result, unsigned shift> |
392 |
struct lshift : public std::unary_function<Arg, Result> |
398 |
struct lshift |
393 |
{ |
399 |
{ |
|
|
400 |
typedef Arg argument_type; |
401 |
typedef Result result_type; |
394 |
Result operator()(const Arg &x) const { return x << shift; } |
402 |
Result operator()(const Arg &x) const { return x << shift; } |
395 |
}; |
403 |
}; |
396 |
|
404 |
|
397 |
template <typename Arg, typename Result, unsigned shift> |
405 |
template <typename Arg, typename Result, unsigned shift> |
398 |
struct rshift : public std::unary_function<Arg, Result> |
406 |
struct rshift |
399 |
{ |
407 |
{ |
|
|
408 |
typedef Arg argument_type; |
409 |
typedef Result result_type; |
400 |
Result operator()(const Arg &x) const { return x >> shift; } |
410 |
Result operator()(const Arg &x) const { return x >> shift; } |
401 |
}; |
411 |
}; |
402 |
|
412 |
|
Lines 491-498
private:
Link Here
|
491 |
}; |
501 |
}; |
492 |
|
502 |
|
493 |
template <typename Arg, typename Result> |
503 |
template <typename Arg, typename Result> |
494 |
struct floatToFloat : public std::unary_function<Arg, Result> |
504 |
struct floatToFloat |
495 |
{ |
505 |
{ |
|
|
506 |
typedef Arg argument_type; |
507 |
typedef Result result_type; |
496 |
Result operator()(Arg x) const { return x; } |
508 |
Result operator()(Arg x) const { return x; } |
497 |
}; |
509 |
}; |
498 |
|
510 |
|