-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
122 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "binarytool.h" | ||
|
||
void BinaryTool::fillInt(unsigned char* in, int pos, unsigned int intVar) | ||
{ | ||
in[pos + 3] = intVar & 0xff; | ||
in[pos + 2] = (intVar & 0xff00) >> 8; | ||
in[pos + 1] = (intVar & 0xff0000) >> 16; | ||
in[pos] = (intVar & 0xff000000) >> 24; | ||
} | ||
|
||
unsigned int BinaryTool::getInt(const unsigned char* in, int pos) | ||
{ | ||
return (unsigned char)(*(in + pos + 3)) | ||
+ ((unsigned char)(*(in + pos + 2)) << 8) | ||
+ ((unsigned char)(*(in + pos + 1)) << 16) | ||
+ ((unsigned char)(*(in + pos)) << 16); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef __BINARY_TOOL_H__ | ||
#define __BINARY_TOOL_H__ | ||
|
||
class BinaryTool{ | ||
public: | ||
static void fillInt(unsigned char* in, int pos, unsigned int intVar); | ||
static unsigned int getInt(const unsigned char* in, int pos); | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters