From 8418ac96e64750821865164b0f63e5d3657cc396 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 17 May 2012 07:40:29 +0000 Subject: [PATCH] examples remove math.h and replace pow(2, x) by 1 << x --- examples/mifare-desfire-access.c | 1 - examples/mifare-desfire-create-ndef.c | 2 +- examples/mifare-desfire-info.c | 5 ++--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/mifare-desfire-access.c b/examples/mifare-desfire-access.c index e08949e..9cfbbe7 100644 --- a/examples/mifare-desfire-access.c +++ b/examples/mifare-desfire-access.c @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/examples/mifare-desfire-create-ndef.c b/examples/mifare-desfire-create-ndef.c index 68f54ea..c3a854a 100644 --- a/examples/mifare-desfire-create-ndef.c +++ b/examples/mifare-desfire-create-ndef.c @@ -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) diff --git a/examples/mifare-desfire-info.c b/examples/mifare-desfire-info.c index a4fb480..c8f06b1 100644 --- a/examples/mifare-desfire-info.c +++ b/examples/mifare-desfire-info.c @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -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;