File size: 2,284 Bytes
9375c9a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates. --><head><title>dlib C++ Library - count_bits_abstract.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2013 Davis E. King ([email protected])
</font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license.
</font><font color='#0000FF'>#undef</font> DLIB_COUNT_BiTS_ABSTRACT_Hh_
<font color='#0000FF'>#ifdef</font> DLIB_COUNT_BiTS_ABSTRACT_Hh_
<font color='#0000FF'>namespace</font> dlib
<b>{</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>></font>
T <b><a name='count_bits'></a>count_bits</b> <font face='Lucida Console'>(</font>
T v
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
requires
- T is an unsigned integral type
ensures
- returns the number of bits in v which are set to 1.
!*/</font>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font>
<font color='#0000FF'>typename</font> T
<font color='#5555FF'>></font>
T <b><a name='hamming_distance'></a>hamming_distance</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> T<font color='#5555FF'>&</font> a,
<font color='#0000FF'>const</font> T<font color='#5555FF'>&</font> b
<font face='Lucida Console'>)</font>;
<font color='#009900'>/*!
requires
- T is an unsigned integral type
ensures
- returns the number of bits which differ between a and b. (I.e. returns
count_bits(a^b).)
!*/</font>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_COUNT_BiTS_ABSTRACT_Hh_
</font>
</pre></body></html> |