Message275761
| Author | ztane |
|---|---|
| Recipients | benjamin.peterson, christian.heimes, doko, ztane |
| Date | 2016-09-11.10:00:33 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1473588033.59.0.675771231528.issue28055@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
There is no need to ifdef anything, the memcpy is the only correct way to do it. As memcpy is also a reserved identifier in C, the compiler can and will optimize this into a 64-bit access on those platforms where it can be safely done so (x86 for example), e.g. GCC compiles
uint64_t func(char *buf) {
uint64_t rv;
memcpy(&rv, buf+3, sizeof(rv));
return rv;
}
into
movq 3(%rdi), %rax
ret
On Linux 64-bit ABI. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2016-09-11 10:00:33 | ztane | set | recipients: + ztane, doko, christian.heimes, benjamin.peterson |
| 2016-09-11 10:00:33 | ztane | set | messageid: <1473588033.59.0.675771231528.issue28055@psf.upfronthosting.co.za> |
| 2016-09-11 10:00:33 | ztane | link | issue28055 messages |
| 2016-09-11 10:00:33 | ztane | create | |