mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Reduce some var scopes
This commit is contained in:
parent
ac6b0ec1ce
commit
732bc766f9
52 changed files with 318 additions and 409 deletions
|
@ -384,7 +384,6 @@ void printDemodBuff(void) {
|
|||
}
|
||||
|
||||
int CmdPrintDemodBuff(const char *Cmd) {
|
||||
char hex[512] = {0x00};
|
||||
bool hexMode = false;
|
||||
bool errors = false;
|
||||
uint32_t offset = 0;
|
||||
|
@ -425,6 +424,7 @@ int CmdPrintDemodBuff(const char *Cmd) {
|
|||
|
||||
if (hexMode) {
|
||||
char *buf = (char *)(DemodBuffer + offset);
|
||||
char hex[512] = {0x00};
|
||||
int numBits = binarraytohex(hex, sizeof(hex), buf, length);
|
||||
if (numBits == 0) {
|
||||
return PM3_ESOFT;
|
||||
|
@ -745,15 +745,13 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG
|
|||
|
||||
//test
|
||||
double autocv = 0.0; // Autocovariance value
|
||||
double ac_value; // Computed autocorrelation value to be returned
|
||||
double variance; // Computed variance
|
||||
double mean;
|
||||
size_t correlation = 0;
|
||||
int lastmax = 0;
|
||||
|
||||
// in, len, 4000
|
||||
mean = compute_mean(in, len);
|
||||
variance = compute_variance(in, len);
|
||||
double mean = compute_mean(in, len);
|
||||
// Computed variance
|
||||
double variance = compute_variance(in, len);
|
||||
|
||||
static int CorrelBuffer[MAX_GRAPH_TRACE_LEN];
|
||||
|
||||
|
@ -766,8 +764,9 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG
|
|||
|
||||
CorrelBuffer[i] = autocv;
|
||||
|
||||
// Computed autocorrelation value to be returned
|
||||
// Autocorrelation is autocovariance divided by variance
|
||||
ac_value = autocv / variance;
|
||||
double ac_value = autocv / variance;
|
||||
|
||||
// keep track of which distance is repeating.
|
||||
if (ac_value > 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue