LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1046|回复: 4

问个小问题。表笑偶

[复制链接]
发表于 2007-6-26 11:19:02 | 显示全部楼层 |阅读模式
define PAGE_SIZE        (1UL << PAGE_SHIFT)

1UL是什么东西。是不是unsigned long ?
1UL的意思表示1是unsigned long 型的吧?
也就是0x00000001,是这样么?
发表于 2007-6-26 12:41:00 | 显示全部楼层
嗯. 是的. 表示长整型.
下面是关于内核中为什么使用UL的一个解释:
UL is commonly appended to the end of a numerical constant to mark an "unsigned long." UL (or L for long) is necessary because it tells the compiler to treat the value as a long value. This prevents certain architectures from overflowing the bounds of their datatypes. For example, a 16-bit integer can represent numbers between 32,768 and +32,767; an unsigned integer can represent numbers up to 65,535. Using UL allows you to write architecturally independent code for large numbers or long bitmasks.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-6-27 19:38:35 | 显示全部楼层

楼上的在哪找到的?

楼上的在哪找到的?
回复 支持 反对

使用道具 举报

发表于 2007-6-27 20:25:40 | 显示全部楼层
有一本书叫<The Linux kernel Primer  A Top-Down Approach for X86 and PowerPc Architectures>
翻译的名字叫<Linux内核编程>

机械工业出版社出的.
http://www.china-pub.com/computers/common/info.asp?id=30867

在这本书上面的,这本书讲得还比较不错,讲了一些需要用到的那种零碎的知识.
回复 支持 反对

使用道具 举报

发表于 2007-6-27 20:42:23 | 显示全部楼层
Post by scutan
有一本书叫<The Linux kernel Primer  A Top-Down Approach for X86 and PowerPc Architectures>
翻译的名字叫<Linux内核编程>

机械工业出版社出的.
http://www.china-pub.com/computers/common/info.asp?id=30867

在这本书上面的,这本书讲得还比较不错,讲了一些需要用到的那种零碎的知识.

印刷错误太多。不过书上的数据结构关系图还是有些帮助的。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表