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

📄 ascii.cpp

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

// ASCII Encoding

// ASCII characters are 7-bits in length, but a byte contains 8 bits.  There
// is an extra bit that can be used to store information.

// We read all bits, and collapse them together removing the extra bit.

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

// Write the bit 'bit'
static void write_bit(bool bit)
{
    static unsigned int buffer = 0, mask = 128;
    if (bit)
        buffer |= mask;
    if ((mask >>= 1) == 0)
    {
        write_byte(buffer);
        buffer = 0;
        mask = 128;
    }
}

// Send all unsent bits
static void flush_bit_buffer()
{
    int i;
    for (i = 0; i < 7; ++i)
        write_bit(0);
}

// Read a bit and return it
static bool read_bit()
{
    static unsigned int buffer, mask = 0;
    if ((mask >>= 1) == 0)
    {
        buffer = read_byte();
        mask = 128;
    }
    return ((buffer & mask) != 0);
}


void EXPORT ascii_encode()
{
}

⌨️ 快捷键说明

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