Skip to content

Commit

Permalink
Fix SDLProtocolHeader ternary order of operations
Browse files Browse the repository at this point in the history
Fixes #84
  • Loading branch information
Joel Fischer committed Mar 25, 2015
1 parent e9af8e6 commit 9a5638a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolHeader.m
Expand Up @@ -21,7 +21,7 @@ - (NSData *)data {
Byte headerBytes[V1PROTOCOL_HEADERSIZE] = {0};

Byte version = (self.version & 0xF) << 4; // first 4 bits
Byte compressed = self.compressed?1:0 << 3; // next 1 bit
Byte compressed = (self.compressed?1:0) << 3; // next 1 bit
Byte frameType = (self.frameType & 0x7); // last 3 bits

headerBytes[0] = version | compressed | frameType;
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m
Expand Up @@ -21,7 +21,7 @@ - (NSData *)data {
Byte headerBytes[V2PROTOCOL_HEADERSIZE] = {0};

Byte version = (self.version & 0xF) << 4; // first 4 bits
Byte compressed = self.compressed?1:0 << 3; // next 1 bit
Byte compressed = (self.compressed?1:0) << 3; // next 1 bit
Byte frameType = (self.frameType & 0x7); // last 3 bits

headerBytes[0] = version | compressed | frameType;
Expand Down

0 comments on commit 9a5638a

Please sign in to comment.