summaryrefslogtreecommitdiff
path: root/ipc.cpp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-07-17 16:23:43 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-07-17 16:23:43 -0300
commitd608bef678fa97b3af910fa62598c55f33650825 (patch)
tree90f1b4029be89a3ed3c55593b9787371c8037a35 /ipc.cpp
parentc1d93b0bc5a2abcf5e7cadd17ef9db7f57a524fc (diff)
downloadjet-d608bef678fa97b3af910fa62598c55f33650825.tar.gz
jet-d608bef678fa97b3af910fa62598c55f33650825.zip
Restructure source files
Diffstat (limited to 'ipc.cpp')
-rw-r--r--ipc.cpp40
1 files changed, 0 insertions, 40 deletions
diff --git a/ipc.cpp b/ipc.cpp
deleted file mode 100644
index 7d46307..0000000
--- a/ipc.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-enum Operation {
- OP_NULL = 0,
- OP_MOVE1,
- OP_MOVE2,
- OP_MOVE4,
- OP_MOVE8,
- OP_INSERT,
- OP_DELETE,
- OP_SHOW
-};
-
-void encode2(int16_t data, int8_t *message, size_t offset) {
- message[offset] = data & 0x00ff;
- message[offset + 1] = (data & 0xff00) >> 8;
-}
-
-int16_t decode2(int8_t *message, size_t offset) {
- return (int16_t)message[offset + 1] << 8 & 0xff00
- | (int16_t)message[offset] & 0x00ff;
-}
-
-void encode4(int32_t data, int8_t *message, size_t offset) {
- encode2( data & 0x0000ffff, message, offset);
- encode2((data & 0xffff0000) >> 16, message, offset + 2);
-}
-
-int32_t decode4(int8_t *message, size_t offset) {
- return (int32_t)decode2(message, offset + 2) << 16 & 0xffff0000
- | (int32_t)decode2(message, offset) & 0x0000ffff;
-}
-
-void encode8(int64_t data, int8_t *message, size_t offset) {
- encode4( data & 0x00000000ffffffff, message, offset);
- encode4((data & 0xffffffff00000000) >> 32, message, offset + 4);
-}
-
-int64_t decode8(int8_t *message, size_t offset) {
- return (int64_t)decode4(message, offset + 4) << 32 & 0xffffffff00000000
- | (int64_t)decode4(message, offset) & 0x00000000ffffffff;
-}