Explorar o código

optimize sizeof

ithewei %!s(int64=4) %!d(string=hai) anos
pai
achega
fd23246f5c
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 2 1
      event/hevent.h
  2. 1 0
      event/hloop.h

+ 2 - 1
event/hevent.h

@@ -89,6 +89,7 @@ struct hperiod_s {
 };
 
 QUEUE_DECL(offset_buf_t, write_queue);
+// sizeof(struct hio_s)=344 on linux-x64
 struct hio_s {
     HEVENT_FIELDS
     // flags
@@ -105,9 +106,9 @@ struct hio_s {
     unsigned    read_once   :1;     // for hio_read_once
     unsigned    alloced_readbuf :1; // for hio_read_until, hio_set_unpack
 // public:
+    hio_type_e  io_type;
     uint32_t    id; // fd cannot be used as unique identifier, so we provide an id
     int         fd;
-    hio_type_e  io_type;
     int         error;
     int         events;
     int         revents;

+ 1 - 0
event/hloop.h

@@ -68,6 +68,7 @@ typedef enum {
     int                 priority;       \
     HEVENT_FLAGS
 
+// sizeof(struct hevent_s)=64 on x64
 struct hevent_s {
     HEVENT_FIELDS
 };