Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2015, 11:34:25 PM (8 years ago)
Author:
landauf
Message:

made some enums in network library strongly typed. for most other enums in network this isn't possible because they are often used like flags (converted to int and compared with binary operators).
packet::Type now uses uint8_t as underlying type which reduces the network traffic (by default the type was int)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/network/packet/Acknowledgement.cc

    r8858 r11006  
    3838#define PACKET_FLAGS_ACK    0
    3939#define _PACKETID           0
    40 #define _ACKID              _PACKETID + sizeof(packet::Type::Value)
     40#define _ACKID              _PACKETID + sizeof(packet::Type)
    4141
    4242Acknowledgement::Acknowledgement( unsigned int id, unsigned int peerID )
     
    4545  flags_ = flags_ | PACKET_FLAGS_ACK;
    4646  data_=new uint8_t[ getSize() ];
    47   *(Type::Value *)(data_ + _PACKETID ) = Type::Acknowledgement;
     47  *(Type *)(data_ + _PACKETID ) = Type::Acknowledgement;
    4848  *(uint32_t *)(data_ + _ACKID ) = id;
    4949  peerID_=peerID;
Note: See TracChangeset for help on using the changeset viewer.