ETL
0.04.19
Main Page
Related Pages
Classes
Files
File List
File Members
ETL
_bit_rotate.h
Go to the documentation of this file.
1
28
/* === S T A R T =========================================================== */
29
30
#ifndef __ETL__BIT_ROTATE_H
31
#define __ETL__BIT_ROTATE_H
32
33
/* === H E A D E R S ======================================================= */
34
35
/* === M A C R O S ========================================================= */
36
37
/* === T Y P E D E F S ===================================================== */
38
39
/* === C L A S S E S & S T R U C T S ======================================= */
40
41
_ETL_BEGIN_NAMESPACE
42
43
template
<
typename
T> T
44
rot_left
(
const
T &val,
const
int
&bits=1)
45
{
46
return
(T)( ((unsigned)val<<bits)+((unsigned)val>>(
sizeof
(T)*8-bits)) );
47
}
48
49
template
<
typename
T> T
50
rot_right
(
const
T &val,
const
int
&bits=1)
51
{
52
return
(T)( ((unsigned)val>>bits)+((unsigned)val<<(
sizeof
(T)*8-bits)) );
53
}
54
55
_ETL_END_NAMESPACE
56
57
/* === E X T E R N S ======================================================= */
58
59
/* === E N D =============================================================== */
60
61
#endif
62
Generated on Mon Nov 16 2015 15:32:01 for ETL by
1.8.1.2