自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 ubuntu14.04在安装虚拟机VMware Tools-10.0时的编译问题

我想在主机与虚拟机之间共享文件夹,以在windows下使用source insight修改查看源码。通过最简单的VMware Tools方法,我发现在编译安装VMware Tools的时候,发生了许多编译错误,导致 share-file 功能缺失。经查看,是因为内核版本升级,导致虚拟机提供的VMware Tools源码中的一些结构体成员命名需变更,还有新版本内核不再使用一些存在于旧版中的库函数,由

2016-03-17 21:49:28 598 1

原创 在linux下使用mtrace工具检查内存泄露

在linux下使用mtrace工具检查内存泄露。

2015-12-16 18:08:06 604

原创 linux驱动开发:tq2440_leds

linux kernel:2.6.30.4#include #include #include #include #include #include //#include //#include #include #include #include #define DEVICE_NAME "leds" /* 加载模式后,执行”ca

2015-10-21 18:22:04 436

原创 tq2440开发板使用过程中遇到的问题

1.  文件系统镜象大于64M,无法烧进nand flash。这个问题要从Jtag说起。因为某种原因,我的电脑上不能使用Jtag,询问厂家解决方案,未果。所以我比较依赖于厂家固化在nor flash中的uboot。而实际情况是,固化在nor flash里的uboot版本较老,能够支持的最大下载文件小于板上的sdram大小。 我的tq2440开发板上的sdram只有64mb,所以当yaffs

2015-10-16 16:03:52 426

原创 C源码@数据结构与算法->DisjointSet

/* * Disjoint set data structure. * All in one file because it's so short. */#define FastAlg#define NumSets (128)#ifndef _DISJ_SET_Htypedef int DisjSet[NumSets + 1];typedef int

2015-08-29 17:25:33 420

原创 C源码@数据结构与算法->Sorting

/* * testsort.cpp */#include #include #include "sort.h"ElementType Arr[] = {34, 8, 64, 51, 32, 21, 0, 100, 99, 3};void Permute(ElementType A[], int N){ int i; for (i = 0; i < N; ++i) {

2015-08-27 16:25:42 411

原创 C源码@数据结构与算法->BinomialQueue

/* * fatal.h */#include #include #define Error(Str) FatalError(Str)#define FatalError(Str) fprintf(stderr, "%s\n", Str), exit(-1) /* * testbin.cpp */#include #include "binomia

2015-08-24 20:00:22 452

原创 C源码@数据结构与算法->LeftistHeap

/* * testleft.cpp */#include #include "leftheap.h"#define MaxSize 5000int main(){ PriorityQueue H; int i, j; H = Initialize(); for (i = 0, j = MaxSize / 2; i < MaxSize; ++i

2015-08-24 10:00:45 385

原创 C源码@数据结构与算法->PriorityQueues

/* * testheap.cpp */#include #include "binheap.h"#define MaxSize (1000)int main(){ PriorityQueue H; int i, j; H = Initialize(MaxSize); for (i = 0, j = MaxSize / 2; i < MaxS

2015-08-22 16:39:38 564

原创 C源码@数据结构与算法->Hashing

/* * testhash.cpp */#define QuadProb /* Define the appropriate hash algorithm */#include#ifdef SepChain#include "hashsep.h"#endif#ifdef QuadProb#include "hashquad.h"#endif

2015-08-20 20:05:10 439

原创 C源码@数据结构与算法->AVL树

/* * testavl.cpp */#include #include "avltree.h"int main(){ AvlTree T; Position P; int i, j; T = MakeEmpty(NULL); for (i = 0, j = 0; i < 50; ++i, j = (j + 7) % 50) { T =

2015-08-15 16:21:26 429

原创 C源码@数据结构与算法->二分查找树(Binary Search Tree)

/* * testtree.cpp */#include #include "tree.h"int main(){ SearchTree T; Position P; int i, j; T = MakeEmpty(NULL); for (i = 0, j = 0; i < 50; ++i, j = (j + 7) % 50) {

2015-08-15 09:31:05 603

原创 使命栈(stack)实现一个简易的四则运算计算器

运算过程比较简单。在VC控制台输入 四则运算表达式,以按下回车键来获取运算结果。退出控制台,按下CTRL + 'Z'。/* * calculator.cpp */#include #include #include "stack.h"#define EXP_MAX_SIZE 64 char infix_exp[EXP_MAX_SIZE];int po

2015-08-12 18:53:58 822

原创 C源码@数据结构与算法->队列(queue)

/* * testqueue.cpp */#include #include "queue.h"int main(){ Queue Q = NULL; int i; Q = CreateQueue(12); for (i = 0; i < 10; ++i) { Enqueue(i, Q); } while (!IsEmpty

2015-08-12 18:23:46 411

原创 C源码@数据结构与算法->栈Stack

/* * fatal.h * Header file for print error message. */#ifndef _FATAL_H#define _FATAL_H#include #include #define Error(str) FatalError(str)#define FatalError(str) fprintf(stderr,

2015-08-11 16:14:54 424

原创 C源码@数据结构与算法->表(Cursor )

/* * fatal.h * Header file for print error message. */#ifndef _FATAL_H#define _FATAL_H#include #include #define Error(str) FatalError(str)#define FatalError(str) fprintf(stderr,

2015-08-11 10:44:18 411

原创 C源码@数据结构与算法->基数排序

本文仅作原理的简单实现。代码中,使用链表来进行bucket的模拟较为妥当,如若下文一般,使用数组,需使用较多的ram(4 * 10 * size bytes)。原理分析,百度百科,各种博客,资源很多,不作赘述。#include #include #define fatal_error(str) fprintf(stderr, "%s\n", str), exit(-1)in

2015-08-10 19:14:45 514

原创 C源码@数据结构与算法->表

/* * fatal.h * Header file for print error message. */#ifndef _FATAL_H#define _FATAL_H#include #include #define Error(str) FatalError(str)#define FatalError(str) fprintf(stderr,

2015-08-10 14:15:06 651

原创 通过 Linux文件描述符/Windows句柄 来看 C语言里的"FILE"

1.“文件”的由来一个程序的I/O指代了程序与外界的交互,包括文件、管道、网络、命令行、信号等。更广义地讲,I/O指代任何操作系统理解为“文件”的事务。许多操作系统,包括Linux和Windows,都将各种具有输入和输出概念的实体——包括设备、磁盘文件、命令行等——统称为文件,因此这里所说的文件是一个广义的概念。对于一个任意类型文件,操作系统会提供一组操作函数,这包括打开文件、读文件、写文

2015-08-04 11:27:57 1697

原创 C语言变长参数的认识以及宏实现

很多时候,我们希望可以在函数中使用任意数量任意类型的函数参数,本文就是从这个点出发,粗略地探知其实现过程。

2015-08-03 10:55:24 2713 2

原创 参数值的传递不是函数的任务!

参数值的传递不是函数的任务!函数名仅仅标示着一段执行代码的地址!

2015-07-30 13:39:36 569

原创 通过异或交换变量的数值

通过异或交换变量的数值,最我最为推荐的swap方法,相比借用第三变量,“temp = a; a = b; b = temp” , 异或交换 更有效率!利用加减法,“a = a + b; b = a - b;  a = a - b”,异或交换 适用范围更广。这里的适用范围更广,说得有点牵强。加减法给我的直观感觉是 不安全,当“a = a + b”的结果超出了该变量类型所支持的数值范围,会

2015-07-25 11:12:57 612

原创 看看编译器是怎样用乘法代替除法的

在0与1的计算机世界中,最复杂的运算就是除法了。复杂到什么程度呢?就是不到万不得已的情况下,连编译器自己都不愿意产生除法指令。备注:以下分析,主要针对的情况为 除数不是2的指数。如果除法是2的指数,尽可以简单地使用移位来运算。比如, 20 / 4 = 20 >> 2 = 5(2 ^ '2' = 4)。

2015-07-21 19:20:57 3561

原创 看看GNU编译器都生成了什么样的汇编代码

看看GNU的编译器生成的汇编代码是什么样的。

2015-07-09 19:57:08 1321

原创 请尽量不要为全局变量赋不必要的初值!

我知道“不要为全局变量赋初值”,完全不符合大多数人遵循的编码规范。所以此文只是一个建议,主要针对单片机工程师,因为单片机的ROM比较宝贵。

2015-07-08 10:14:35 4334

原创 AT&T Assembly Language Samples

1. Simple Samples1.1 cpuid.s#cpuid.s Sample program to extract the processor Vendor ID# - cpuid instruction code is used to gather information about the process,# depending on the value of th

2015-07-07 13:44:04 731

原创 读取PBOC电子现金指令流

在T=0协议下,读取PBOC电子现金的指令流.

2015-07-06 12:48:26 2892

原创 AT&T Assembly Language Note

1. Some ToolsUnlike a high-level language environment in which you can purchase a complete development environment, you often have to piece together an assembly language development environment. At

2015-06-28 14:54:22 661

原创 探究VC下的_T(""),发现:双字节字符/多字节字符是以小端存储的(至少是在VC2013环境下)

从VC6.0过渡到VS2013的程序员应该都会对字符的表现形式感到困惑,每每都要使用_T(""),才能如愿地显示字符。其实_T("")是一个宏,起一个兼容的作用,使编译器采用默认的字符集形式(Ansi或Unicode)编译字符串。在VC2013的 tchar.h 文件中,我提取出了部分代码,如下:#ifdef _UNICODE// ...#define __T(x)

2015-06-25 22:19:54 900

原创 有关VC++的一些外文链接

Use of "Stdafx.h"

2015-06-24 10:32:26 493

原创 Win32串口通讯函数PurgeComm不能清接收缓冲区的问题

这两天在做串口通讯上位机的开发,遇到了一个比较棘手的问题。使用Win32函数PurgeComm始终不能成功清除接收缓冲区中的数据,老是接收到不需要的数据。刚开始,我以为是我的串口配置出了问题,检查了一遍,没发现什么问题。然后,就开始百度,搜到的相关网页挺多的,却没什么卵用。后来,抱着试试看的态度,我使用国外搜索引擎“http://www.aol.com/”。国外一位同行说,他也遇到

2015-06-17 08:34:05 7000

原创 DesignPatterns_Visitor

////////////////////////////////////////////////////////////////////////////////////// Visitor pattern// - Represent an operation to be performed on the elements of an object structure.// Visi

2015-05-21 22:19:59 475

原创 DesignPatterns_TemplateMethod

////////////////////////////////////////////////////////////////////////////// Template Method pattern// - Define the skeleton of an algorithm in an operation, deferring some steps// to subcla

2015-05-17 22:54:42 449

原创 DesignPatterns_Strategy

/////////////////////////////////////////////////////////////////////////////// Strategy pattern// - Define a family of algorithms, encapsulate each one, and make them// interchangeable. Strat

2015-05-17 21:39:27 452

原创 DesignPatterns_State

/////////////////////////////////////////////////////////////////////////////////////// State pattern// - Allow an object to alter its behavior when its internal state changes. The object// wi

2015-05-17 13:57:21 405

原创 DesignPatterns_Observer

///////////////////////////////////////////////////////////////////////////////// Observer pattern// - Define a one-to-many dependency between objects so that when one object// changes state,

2015-05-16 14:54:47 417

原创 DesignPatterns_Memento

/////////////////////////////////////////////////////////////////////////////////////////// Memento pattern// - Without violating encapsulation, capture and externalize an object's internal state

2015-05-15 18:13:31 450

原创 DesignPatterns_Mediator

/////////////////////////////////////////////////////////////////////////////////////////// Mediator pattern// - Define an object that encapsulates how a set of objects interact. Mediator promotes

2015-05-15 11:05:07 396

原创 DesignPatterns_Iterator

/////////////////////////////////////////////////////////////////////////////////////////// Iterator// - Provide a way to access the elements of an aggregate object sequentially without// expo

2015-05-14 17:52:18 429

原创 DesignPatterns_Interpreter

///////////////////////////////////////////////////////////////////////////////////////// Interpreter pattern// - Given a language, define a represention for its grammar along with an interpreter

2015-05-14 12:23:31 432

空空如也

空空如也

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

TA关注的人

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