⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nbe.cpp

📁 非常好用的五子棋游戏源码
💻 CPP
字号:
// Created:10-24-98
// By Jeff Connelly

// NBEncoding (nibble-byte encoding)

// Converts binary to plain text, like UUE and HEX

// A byte is splitted into two bytes, thus:
//     a and b are nibbles, f is a fixed nibble that is always the same
//     ab -> fafb
// Example help:
// Data: 1010    0101
//       high    low
//
// Encoded: 0100 1010 0100 0101
//         FIXED high FIXED low
// 
// The 'fixed' bytes are always the same.

#include "stdafx.h"
#define EXPORTING
#include "comprlib.h"

void EXPORT nb_encode()
{
    register char c;        // Character
    register char h, l;     // High and low nibbles
    const char fixed = 4;   // Fixed nibble = 0100

    while (!end_of_data())
    {
        c = read_byte();

        // Isolate the nibbles
        h = c & 0xF0;
        l = c & 0x0F;

        // Apply 'fixed' constent
        h |= fixed;
        l |= fixed;

        write_byte(h);
        write_byte(l);
    }
}

void EXPORT nb_decode()
{
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -