摘要: 在 GCC 手册中对 __builtin_expect() 的描述是这样的: 由于大部分程序员在分支预测方面做得很糟糕,所以 GCC 提供了这个内建函数来帮助程序员处理分支预测,优化程序。其第一个参数 exp 为一个整型表达式,这个内建函数的返回值也是这个 exp ,而 c 为一个编译期常量。这个函 阅读全文
posted @ 2017-09-27 10:25 SarahLiu77 阅读(316) 评论(0) 推荐(1) 编辑
摘要: gflags是什么: gflags是google的一个开源的处理命令行参数的库,使用c++开发,具备python接口,可以替代getopt。 gflags使用起来比getopt方便,但是不支持参数的简写(例如getopt支持--list缩写成-l,gflags不支持)。 如何安装使用gflags: 阅读全文
posted @ 2017-07-05 14:56 SarahLiu77 阅读(5149) 评论(0) 推荐(1) 编辑
摘要: 本文来自CSDN博客:http://blog.csdn.NET/program_think/archive/2009/05/31/4229773.aspx 今天来介绍一下“Protocol Buffers ”(以下简称protobuf)这个玩意儿。本来俺在构思“生产者/消费者模式 ”系列的下一个帖子 阅读全文
posted @ 2017-06-28 15:50 SarahLiu77 阅读(273) 评论(0) 推荐(1) 编辑
摘要: 讯息等级 系统将讯息分为七个主要的等级,依序是由不重要排列到重要讯息等级: info:仅是一些基本的讯息说明而已; notice:比 info 还需要被注意到的一些信息内容; warning 或 warn:警示讯息,可能有问题,但是还不至于影响到某个 daemon 运作。 err 或 error : 阅读全文
posted @ 2017-05-18 16:35 SarahLiu77 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 1.LuaJit安装 这样luajit就被安装到了/usr/local/ 文件夹下面。 2.ngx_devel_kit 3.ngx_lua 4.告诉nginx编译器去哪儿找到luajit 5.编译nginx prefix指出nginx将被安装的目录,这里选择了/usr/local/。 6.make 阅读全文
posted @ 2017-05-18 15:04 SarahLiu77 阅读(212) 评论(0) 推荐(0) 编辑
摘要: lua源文件下载安装 到官网安装了lua包,我安装的是 lua-5.3.1 解压之后,命令行cd进入到src目录下,输入make macosx 完成后cd ..到上一层目录, 输入sudo make install Sublime 安装与配置 下载地址:sublimetext 配置运行环境:打开su 阅读全文
posted @ 2017-05-17 18:00 SarahLiu77 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 问题描述: Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. 阅读全文
posted @ 2017-04-13 09:25 SarahLiu77 阅读(409) 评论(0) 推荐(0) 编辑
摘要: A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents 阅读全文
posted @ 2016-12-22 16:00 SarahLiu77 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 有些程序要处理二进制位的有序集,每个位可能包含的是0(关)或1(开)的值。位是用来保存一组项或条件的yes/no信息(有时也称标志)的简洁方法。标准库提供了bitset类使得处理位集合更容易一些。要使用bitset类就必须要包含相关的头文件。在本书提供的例子中,假设都使用了std::bitset的u 阅读全文
posted @ 2016-12-22 15:53 SarahLiu77 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2016-12-21 16:35 SarahLiu77 阅读(176) 评论(0) 推荐(0) 编辑