mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 05:43:23 -07:00
simplify some code, add comments
ABS simplification from Iceman1001
This commit is contained in:
parent
29ada8fc08
commit
cf194819cc
6 changed files with 47 additions and 81 deletions
|
@ -319,18 +319,7 @@ static int GetIso15693AnswerFromTag(uint8_t *receivedResponse, int maxLen, int *
|
|||
// every other is Q. We just want power, so abs(I) + abs(Q) is
|
||||
// close to what we want.
|
||||
if(getNext) {
|
||||
int8_t r;
|
||||
|
||||
if(b < 0) {
|
||||
r = -b;
|
||||
} else {
|
||||
r = b;
|
||||
}
|
||||
if(prev < 0) {
|
||||
r -= prev;
|
||||
} else {
|
||||
r += prev;
|
||||
}
|
||||
int8_t r = ABS(b) + ABS(prev);
|
||||
|
||||
dest[c++] = (uint8_t)r;
|
||||
|
||||
|
@ -468,18 +457,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *receivedResponse, int maxLen, int
|
|||
// every other is Q. We just want power, so abs(I) + abs(Q) is
|
||||
// close to what we want.
|
||||
if(getNext) {
|
||||
int8_t r;
|
||||
|
||||
if(b < 0) {
|
||||
r = -b;
|
||||
} else {
|
||||
r = b;
|
||||
}
|
||||
if(prev < 0) {
|
||||
r -= prev;
|
||||
} else {
|
||||
r += prev;
|
||||
}
|
||||
int8_t r = ABS(b) + ABS(prev);
|
||||
|
||||
dest[c++] = (uint8_t)r;
|
||||
|
||||
|
@ -648,18 +626,7 @@ void AcquireRawAdcSamplesIso15693(void)
|
|||
// every other is Q. We just want power, so abs(I) + abs(Q) is
|
||||
// close to what we want.
|
||||
if(getNext) {
|
||||
int8_t r;
|
||||
|
||||
if(b < 0) {
|
||||
r = -b;
|
||||
} else {
|
||||
r = b;
|
||||
}
|
||||
if(prev < 0) {
|
||||
r -= prev;
|
||||
} else {
|
||||
r += prev;
|
||||
}
|
||||
int8_t r = ABS(b) + ABS(prev);
|
||||
|
||||
dest[c++] = (uint8_t)r;
|
||||
|
||||
|
@ -713,18 +680,7 @@ void RecordRawAdcSamplesIso15693(void)
|
|||
// every other is Q. We just want power, so abs(I) + abs(Q) is
|
||||
// close to what we want.
|
||||
if(getNext) {
|
||||
int8_t r;
|
||||
|
||||
if(b < 0) {
|
||||
r = -b;
|
||||
} else {
|
||||
r = b;
|
||||
}
|
||||
if(prev < 0) {
|
||||
r -= prev;
|
||||
} else {
|
||||
r += prev;
|
||||
}
|
||||
int8_t r = ABS(b) + ABS(prev);
|
||||
|
||||
dest[c++] = (uint8_t)r;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue