Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 1039:2ea9d52111e2, committed 2015-12-10
- Comitter:
- rgrover1
- Date:
- Thu Dec 10 09:15:04 2015 +0000
- Parent:
- 1038:ebf9746bff7d
- Child:
- 1040:7d010fd2a1f2
- Commit message:
- Synchronized with git rev 694130ff
Author: Rohit Grover
use std::reverse_copy to switch byte-order
Changed in this revision
| ble/UUID.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ble/UUID.h Thu Dec 10 09:15:04 2015 +0000
+++ b/ble/UUID.h Thu Dec 10 09:15:04 2015 +0000
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <string.h>
+#include <algorithm>
#include "blecommon.h"
@@ -177,11 +178,9 @@
type = UUID_TYPE_LONG;
if (order == UUID::MSB) {
// Switch endian. Input is big-endian, internal representation is little endian.
- for (size_t index = 0; index < LENGTH_OF_LONG_UUID; index++) {
- baseUUID[LENGTH_OF_LONG_UUID - 1 - index] = longUUID[index];
- }
+ std::reverse_copy(longUUID, longUUID + LENGTH_OF_LONG_UUID, baseUUID);
} else {
- memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID);
+ std::copy(longUUID, longUUID + LENGTH_OF_LONG_UUID, baseUUID);
}
shortUUID = (uint16_t)((baseUUID[13] << 8) | (baseUUID[12]));
}
