Commit c94a815
committed
Allow XBeeAddress64 to work with uint64_t variables
This adds:
- A constructor that takes a single uint64_t variable. This allows
implicitly converting integers to XBeeAddress64 values, so these will
work:
XBeeAddress64 dest = 0x0;
request.setAddress64(0x0013A21234567890);
(note that the latter also requires some const-correctness fixes in
methods taking XBeeAddress64 arguments).
- A get() and set() method for getting and setting the address as a
uint64_t.
- A operator uint64_t() which allows the XBeeAddress64 to be
implicitely converted to a uint64_t. E.g.:
uint64_t address = resp.getRemoteAddress64();
But also comparison:
resp.getRemoteAddress64() == XBeeAddress64(0, 0)
resp.getRemoteAddress64() == 0x0013A21234567890);
Note that both comparisons above work by converting to uint64_t and
comparing those.
Because this removes the need for separate comparison operators, the
ones that were there (but still commented out) were removed.
Note that avr-gcc doesn't currently optimize uint64_t values very well,
so the storage is still left as two separate uint32_t values. If you use
the msb/lsb accessors, code should be unchanged compared to before, but
if you use the uint64_t accessors or compare addresses, code will be
less efficient. This will hopefully be fixed in a future compiler
version, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66511.1 parent 197e360 commit c94a815
2 files changed
+25
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1031 | 1035 | | |
1032 | 1036 | | |
1033 | 1037 | | |
| |||
1044 | 1048 | | |
1045 | 1049 | | |
1046 | 1050 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
1051 | 1054 | | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1055 | 1063 | | |
1056 | 1064 | | |
1057 | 1065 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
295 | 299 | | |
296 | 300 | | |
297 | 301 | | |
| 302 | + | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
301 | 306 | | |
| 307 | + | |
| 308 | + | |
302 | 309 | | |
303 | 310 | | |
304 | | - | |
305 | | - | |
| 311 | + | |
306 | 312 | | |
| 313 | + | |
| 314 | + | |
307 | 315 | | |
308 | 316 | | |
309 | 317 | | |
| |||
0 commit comments