自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(7)
  • 资源 (1)
  • 收藏
  • 关注

转载 内核中的 likely() 与 unlikely()

内核中的 likely() 与 unlikely()在 2.6 内核中,随处可以见到 likely() 和 unlikely() 的身影,那么为什么要用它们?它们之间有什么区别?首先要明确:            if(likely(value)) 等价于 if(value)            if(unlikely(value)) 也等价于 if(value)

2015-01-06 17:07:54 307

原创 list_entry

<br />list_entry这样定义:<br /><br />                #define list_entry(ptr, type, member) /<br />                                            ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))<br /><br />解释:找到成员member所在容器的地址。如果是结构体的话,就是找到结构体成员变量me

2010-10-25 15:37:00 346

原创 list_for_each_safe()

<br />如果在遍历过程中,包含有删除或移动当前链接节点的操作,由于这些操作会修改遍历指针,这样会导致遍历的中端。这种情况下,必须使用list_for_each_safe宏,在操作之前将遍历指针缓存下来。内核中解释的精华部分:<br />/*<br /> list_for_each_safe                 -iterate over a list safe against removal of list entry<br />*/<br />#define list_for_each_s

2010-10-25 14:46:00 1882

原创 查找字符串

<br />view plaincopy to clipboardprint?<br />#include <stdio.h>  <br />#include <string.h>   <br />typedef int BOOL;  <br />#define true    1  <br />#define false   0   <br />BOOL findsubstring(const char *bigsrc, const char *littlesrc)   <br />{   <br /> 

2010-10-25 13:17:00 631

原创 删除字串

<br />/*判断第二个字符串是否为第一字符串的子串,如果是,则将该子串删除  <br />比如 bissrc = a123afed  <br />    littlesrc = afe;  <br />    返回a123d;  <br />*/ <br />#include <stdio.h>  <br />#include <string.h>  <br />#include <stdlib.h>   <br />//判断一个字符串是否为另一个的子串,如果是,返回该子串首字母所在的位置   <br

2010-10-25 13:15:00 440

原创 字符串反转

<br />view plaincopy to clipboardprint?<br />#include <stdio.h>  <br />#include <string.h>   <br />void reverse_string(char *str)   <br />{   <br />    char *lastchar;   <br />    char tmp;   <br />    for (lastchar = str; *lastchar != '/0'; lastchar++)  

2010-10-25 13:14:00 215

转载 container_of

<br />问题:如何通过结构中的某个变量获取结构本身的指针???<br />关于container_of见kernel.h中:<br />/**<br />* container_of - cast a member of a structure out to the containing structure<br />* @ptr:     the pointer to the member.<br />* @type:     the type of the container struct this

2010-10-25 12:52:00 329

nrzi 编码,及其发展

介绍nrzi 编码nrzi 编码,及其发展,比较简单了

2010-12-08

空空如也

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

TA关注的人

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