#include <stdio.h>//android 读取LEB数据 int readUnsignedLeb128(const int ** pStream) {    const int * ptr = *pStream;    int result = *(ptr++);    if (result > 0x7f) {        int cur = *(ptr++);        result = (result & 0x7f) | ((cur & 0x7f) << 7);        if (cur > 0x7f) {            cur = *(ptr++);            result |= (cur & 0x7f) << 14;            if (cur > 0x7f) {                cur = *(ptr++);                result |= (cur & 0x7f) << 21;                if (cur > 0x7f) {                    /*                     * Note: We don't check to see if cur is out of                     * range here, meaning we tolerate garbage in the                     * high four-order bits.                     */                    cur = *(ptr++);                    result |= cur << 28;                }            }        }    }    *pStream = ptr;    return result;} int readSignedLeb128(const int** pStream) {    const int* ptr = *pStream;    int result = *(ptr++);    if (result <= 0x7f) {        result = (result << 25) >> 25;    } else {        int cur = *(ptr++);        result = (result & 0x7f) | ((cur & 0x7f) << 7);        if (cur <= 0x7f) {            result = (result << 18) >> 18;        } else {            cur = *(ptr++);            result |= (cur & 0x7f) << 14;            if (cur <= 0x7f) {                result = (result << 11) >> 11;            } else {                cur = *(ptr++);                result |= (cur & 0x7f) << 21;                if (cur <= 0x7f) {                    result = (result << 4) >> 4;                } else {                    /*                     * Note: We don't check to see if cur is out of                     * range here, meaning we tolerate garbage in the                     * high four-order bits.                     */                    cur = *(ptr++);                    result |= cur << 28;                }            }        }    }    *pStream = ptr;    return result;}void main(){//const int a=0xc0839225;//没有权限读取0xc0839225地址;int c=readUnsignedLeb128((const int **)0xc0839225);printf("%d\n",c);c=readSignedLeb128((const int **)0xd1c2b340);printf("%d\n",c);}

更多相关文章

  1. android中在切换fragment时,怎样做到无需重复加载数据的方法。
  2. android API文档下载地址
  3. Android 将一个数据对象保存到本地以及读取的方法
  4. 自定义progressBar显示静态数据
  5. 关于android Ip地址的获取
  6. android之解析json数据格式详解
  7. android 本地存取复杂数据
  8. android 系统数据库

随机推荐

  1. 三层缓存机制-新知识点,Android常见的内存
  2. 深入理解Android消息处理系统——Looper
  3. Android设计模式系列-单例模式
  4. Android(安卓)http超时选项的测试
  5. [对android程序作代码混淆]
  6. Android屏幕适配全攻略(最权威的官方适配
  7. android去掉button默认的点击阴影
  8. Android(安卓)事件分发详解及示例代码
  9. [Android] ubuntu 下不识别 Android(安卓
  10. Android(安卓)Log详解!