examples remove math.h and replace pow(2, x) by 1 << x
This commit is contained in:
parent
90f41b245e
commit
8418ac96e6
3 changed files with 3 additions and 5 deletions
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ main(int argc, char *argv[])
|
|||
0x00 // free write acces
|
||||
};
|
||||
uint16_t ndefmaxsize = 0x0800;
|
||||
uint16_t announcedsize = 2 << ((info.software.storage_size >> 1) - 1);
|
||||
uint16_t announcedsize = 1 << (info.software.storage_size >> 1);
|
||||
if (announcedsize >= 0x1000)
|
||||
ndefmaxsize = 0x1000;
|
||||
if (announcedsize >= 0x1E00)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -92,14 +91,14 @@ main(int argc, char *argv[])
|
|||
printf (" Type: 0x%02x\n", info.hardware.type);
|
||||
printf (" Subtype: 0x%02x\n", info.hardware.subtype);
|
||||
printf (" Version: %d.%d\n", info.hardware.version_major, info.hardware.version_minor);
|
||||
printf (" Storage size: 0x%02x (%s%d bytes)\n", info.hardware.storage_size, (info.hardware.storage_size & 1) ? ">" : "=", (int)pow (2, info.hardware.storage_size >> 1));
|
||||
printf (" Storage size: 0x%02x (%s%d bytes)\n", info.hardware.storage_size, (info.hardware.storage_size & 1) ? ">" : "=", 1 << (info.hardware.storage_size >> 1));
|
||||
printf (" Protocol: 0x%02x\n", info.hardware.protocol);
|
||||
printf ("Software Information:\n");
|
||||
printf (" Vendor ID: 0x%02x\n", info.software.vendor_id);
|
||||
printf (" Type: 0x%02x\n", info.software.type);
|
||||
printf (" Subtype: 0x%02x\n", info.software.subtype);
|
||||
printf (" Version: %d.%d\n", info.software.version_major, info.software.version_minor);
|
||||
printf (" Storage size: 0x%02x (%s%d bytes)\n", info.software.storage_size, (info.software.storage_size & 1) ? ">" : "=", (int)pow (2, info.software.storage_size >> 1));
|
||||
printf (" Storage size: 0x%02x (%s%d bytes)\n", info.software.storage_size, (info.software.storage_size & 1) ? ">" : "=", 1 << (info.software.storage_size >> 1));
|
||||
printf (" Protocol: 0x%02x\n", info.software.protocol);
|
||||
|
||||
uint8_t settings;
|
||||
|
|
Loading…
Reference in a new issue