自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 设计模式Before-after之代理模式

before.cxx #include #include class Console { public: void write(std::string msg) { std::cout << msg; } }; int main(void) { Console console; console.write("hello"); console.write(", "); co

2014-04-01 23:39:23 671

原创 使用 flex & bison 生成科学计算器

scanner.l %{ #include #include #define YYSTYPE double #include "parser.h" %} %option noyywrap digit [0-9] space [\t\n ] number {digit}+(\.{digit}*)?|\.{digit}+ abs (?i:abs) exp (?i:exp) log (

2014-03-25 23:38:00 1023

原创 设计模式Before-after之享元模式

before.cxx#include #include class ACounter { public: unsigned int count(const std::string &input) { unsigned int count = 0; for (int i = 0; i < input.length(); ++i) { if (input[i] == 'a' ||

2014-03-21 18:22:47 513

原创 设计模式Before-after之单例模式

before.cxx #include class OS { public: const char *getName(void) { return "Microsoft Windows"; } const char *getVersion(void) { return "6.1.7601"; } }; OS os; void displayCurrentOSName(vo

2014-03-17 13:55:55 646

原创 设计模式Before-after之装饰模式

before.cxx #include class RobotCat { public: void cry(void) { std::cout << "Meow! Meow! Meow!" << std::endl; } }; class RobotCatCanWalk: public RobotCat { public: void walk(void) { std::cou

2014-03-17 10:21:40 605

原创 设计模式Before-after之组合模式

before.cxx #include #include class Element { public: Element(int value): value(value) {}; void remove(void) { std::cout value << " has been removed." << std::endl; } private: int value; };

2014-03-15 00:35:10 646

原创 虚拟内存页号 to 物理内存页号

虚拟内存地址 = (虚拟内存页号,内存页内偏移) 物理内存地址 = (物理内存页号,内存页内偏移) if 查快表,虚拟内存页在TLB中 then case 1: 虚拟内存地址 to 物理内存地址; else // 查快表,虚拟内存页不在TLB中 case 2: if 查内表,虚拟内存页有对应的物理内存页 then case 3

2014-03-14 23:13:35 2837

原创 L1缓存命中

typedef struct { uint24_t tag; unsigned char content[64]; } cache_line_t; typedef struct { cache_line_t lines[8]; } cache_set_t; typedef struct { cache_set_t sets[64]; } l1_cache_t; typedef str

2014-03-14 20:33:59 718

原创 操作数的寻址方式

操作数:指令中进行数字运算的量,值。   立即寻址:操作数被包含在指令中。例:mov ax, 0   寄存器寻址:存储操作数的寄存器被包含在指令中。例:mov ax, bx   直接寻址:存储操作数的内存的地址被包含在指令中。例:mov ax, [1234H]   寄存器间接寻址:存储存储操作数的内存’的地址的寄存器被包含在指令中。例:movax, [bx]   寄存器相对寻址

2014-03-13 19:15:44 1044

原创 设计模式Before-after之桥接模式

before.cxx #include class BlackCircle { public: void what(void) { std::cout << "a black circle." << std::endl; } }; class BlackSquare { public: void what(void) { std::cout << "a black squar

2014-03-12 23:39:50 545

原创 设计模式Before-after之适配器模式

before.cxx #include class Dog { public: void runAway(void) { std::cout << "HELP!!! Dog-god bless me!" << std::endl; } }; class DogHunter { public: void hunt(Dog &dog) { dog.runAway(); } };

2014-03-12 20:10:53 629

原创 设计模式Before-after之原型模式

before.cxx #include class Factorial { public: Factorial(unsigned int n) { double value = 1; for (unsigned int k = 2; k < n; ++k) { value *= k; } this->value = value; } void displayVal

2014-03-12 13:21:39 1122

原创 设计模式Before-after之建造者模式

before.cxx #include #include class Shape { public: void setColor(const std::string &colorName) { this->colorName = colorName; } void setKind(const std::string &kindName) { this->kindName =

2014-03-10 23:50:25 595

原创 设计模式Before-after之抽象工厂模式

before.cxx #include #include class BlackCircle { public: void sayHello(void) { std::cout << "Hello, I'm a black circle." << std::endl; } }; class BlackSquare { public: void sayGoodbye(void

2014-03-10 16:38:38 717

原创 设计模式Before-after之工厂方法模式

before.cxx #include #include class Apple { public: void sayHello(void) { std::cout << "Hello, I'm a apple." << std::endl; } }; class Banana { public: void sayHello(void) { std::cout << "He

2014-03-10 15:49:29 647

原创 设计模式Before-after之简单工厂模式

before.cxx #include #include class Apple { public: void sayHello(void) { std::cout << "Hello, I'm a apple." << std::endl; } }; class Banana { public: void sayHello(void) { std::cout << "He

2014-03-10 13:14:50 861

原创 浮点数格式

『单精度浮点数』(高位->低位) 符  号:1位 指数部分:8位 小数部分:23位 整数部分:设定恒为1,因此不需要位 总  计:32位 表  示:1.小数部分 * 2^(指数部分 - 127) =      (2^23 + 小数部分) * 2^(指数部分 - 150) 『双精度浮点数』(高位->低位) 符  号:1位 指数部分:11位 小数部分:52位 整数部分:设

2014-03-08 17:08:08 1055

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除