Skip to content

Commit 2a58df5

Browse files
committed
use aligned reads
1 parent d695c1e commit 2a58df5

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: nanonext
22
Type: Package
33
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
4-
Version: 1.1.1.9014
4+
Version: 1.1.1.9015
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library implementing 'Scalability Protocols', a reliable,
77
high-performance standard for common communications patterns including

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# nanonext 1.1.1.9014 (development)
1+
# nanonext 1.1.1.9015 (development)
22

33
#### New Features
44

src/core.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void nano_serialize(nano_buf *buf, const SEXP object, SEXP hook) {
246246
buf->buf[0] = 0x7;
247247
buf->buf[1] = (uint8_t) vec;
248248
buf->buf[3] = special_bit;
249-
buf->cur += 12;
249+
buf->cur += 16;
250250
}
251251

252252
struct R_outpstream_st output_stream;
@@ -269,8 +269,7 @@ void nano_serialize(nano_buf *buf, const SEXP object, SEXP hook) {
269269
R_Serialize(object, &output_stream);
270270

271271
if (reg && TAG(hook) != R_NilValue) {
272-
const uint64_t cursor = (uint64_t) buf->cur;
273-
memcpy(buf->buf + 4, &cursor, sizeof(uint64_t));
272+
((uint64_t *) (buf->buf))[1] = (uint64_t) buf->cur;
274273
SEXP call, out;
275274

276275
if (vec) {
@@ -340,7 +339,7 @@ SEXP nano_unserialize(unsigned char *buf, const size_t sz, SEXP hook) {
340339
cur = 0;
341340
goto resume;
342341
case 0x7: ;
343-
memcpy(&offset, buf + 4, sizeof(uint64_t));
342+
offset = ((uint64_t *) (buf))[1];
344343
if (offset) {
345344
SEXP raw, call;
346345
if (buf[1]) {
@@ -371,7 +370,7 @@ SEXP nano_unserialize(unsigned char *buf, const size_t sz, SEXP hook) {
371370
}
372371
SET_TAG(hook, reflist);
373372
}
374-
cur = 12;
373+
cur = 16;
375374
goto resume;
376375
}
377376
}

0 commit comments

Comments
 (0)