Binary Expression and Value Expression
来源:互联网 发布:Windows mr 编辑:程序博客网 时间:2024/05/29 08:23
Hi guys
My Email: jakezhang1989@hotmail.com
My GitHub Link
Thank you for taking time to go through this post from which you would get what you want.
If you have any problems or opinions that are different form mins, please email me or leave a comments. I will reply as soon as possible.
OK, Let us get started!
Glossory
HMA : High Memory Address
LMA : Low Memory Address
HB : High Byte
LB : Low Byte
Little endian : a HB is stored in HMA, a LB is stored at LMA
Big endian: a HB is stored in LMA, a LB is stored at HMA
Topic
This blog is to highlight a misunderstanding I used to have that I mixed up the binary expression and value expression regarding to endian swap
Argument
Binary expression is a format used to store a variable in memory whereas value expression is the human-readable values that represents.
Supporting Statements
Say we have (other types follow the same rules)
short a = 128;
Its value expression may look like this:
HB<- - - - - - - - LB
00000000 10000000
{highbyte} {lowbyte}
Its little endian binary expression may look like this:
LMA- - - - - - - - - ->HMA
{lowbyte} {highbyte}
10000000 00000000
Its big endian binary expression may look like this:
LMA- - - - - - - - - ->HMA
{highbyte} {lowbyte}
00000000 10000000
Take the example of little endian a above, I used to think that little endian a has a decimal value of 2^15 as bit 1 is at the index of 15, which should have been decimal value of 128.
Actually, the correct way to represent the value of little endian a by little endian CPU is based on the fact that CPU will always obtain the value expression from binary expression and the value of a variable we often talk about actually points out the value expression (10 base, binary base or 8 base):
When CPU meets the first byte 100000, it knows this byte should be low byte in value expression since the byte is stored in LMA. And the second byte 000000 should be the high byte in value expression. So, the final binary base value expression should be 00000000 10000000, and its decimal value is therefore 2^8 that equals to one we assigned before.
End of the post.
- Binary Expression and Value Expression
- Quarterly Excel value expression
- [[ expression ]]
- expression
- Expression
- Expression
- Expression
- Java and Regular Expression
- Java and Regular Expression
- EXTJS and Reg expression
- xpath and regular expression
- SSIS Expression Language and Variables
- Delegate Events and Lambda expression
- Error setting expression '.css' with value
- Error setting expression '0' with value '/'
- struts2 Error setting expression XXXX with value
- Error setting expression 'token' with value...
- Error setting expression 'orderid' with value ['2', ]
- Java经典面试题集
- 【线段树模板!!!】hdu-1394 顺便学习一下not only succes 的线段树风格
- android国际化(多语言)
- Linux内核分析——操作系统进程调度
- 文件系统类型汇总
- Binary Expression and Value Expression
- Print Numbers by Recursion
- UIActivityIndicatorView的使用
- SharePoint 2010 - Hardware and Software Requirements
- iOS 一次上传多张图片, 并返回进度值
- 递归生成数字解决问题系列
- Log4j最佳实践
- Java多线程下载实现
- Spring AOP学习笔记(4):AOP切面优先级&切面表达式重用&xml配置方式