FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PrefLib/chart/entropychart.cpp at master · PREF/PrefLib · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
PREF
/
PrefLib
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
10
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
PrefLib
/
chart
/
entropychart.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (51 loc) · 1.45 KB
Breadcrumbs
PrefLib
/
chart
/
entropychart.cpp
Copy path
File metadata and controls
71 lines (51 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
include
"
entropychart.h
"
namespace
PrefLib
{
namespace
Chart
{
const
uint64_t
EntropyChart::
NUM_POINTS
=
2048ul
;
const
uint64_t
EntropyChart::
MIN_BLOCK_SIZE
=
32ul
;
EntropyChart::EntropyChart
()
{
}
EntropyChart::~EntropyChart
()
{
}
const
EntropyChart::EntropyPoints &
EntropyChart::points
()
const
{
return
this
->
_points
;
}
uint64_t
EntropyChart::calculateBlockSize
(
uint64_t
len)
{
if
(len < EntropyChart::
MIN_BLOCK_SIZE
)
return
0
;
uint64_t
blocksize =
0
, numpoints = EntropyChart::
NUM_POINTS
, size = len / numpoints;
while
(size < EntropyChart::
MIN_BLOCK_SIZE
)
{
numpoints /=
2u
;
size = len / numpoints;
}
for
(
uint64_t
i =
0
; blocksize < size; i++)
{
uint64_t
bs = (
1u
<< i);
if
(bs > size)
break
;
blocksize = bs;
}
this
->
_points
.
clear
();
this
->
_points
.
reserve
(numpoints);
return
blocksize;
}
void
EntropyChart::elaborate
(
IO
::DataBuffer *databuffer,
uint64_t
startoffset,
uint64_t
endoffset,
volatile
bool
*cancontinue)
{
uint64_t
len = endoffset - startoffset, blocksize =
this
->
calculateBlockSize
(len);
if
(!blocksize)
return
;
for
(
uint64_t
i =
0
; i < len; i += blocksize)
{
if
(cancontinue && !(*cancontinue))
break
;
double
e =
Algorithm::entropy
(databuffer, i, blocksize, cancontinue);
this
->
_points
.
push_back
({
static_cast
<
double
>(i), e });
}
}
}
//
namespace Chart
}
//
namespace PrefLib
Back
|
FazBrowse Home
|
New Git URL