由买买提看人间百态

topics

全部话题 - 话题: 0xf
(共0页)
b**l
发帖数: 51
1
No Need JNI. try this:
===
/*
* @(#)WinRegistry.java 1.4 03/12/19
*
* Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
met:
*
* -Redistribution of source code must retain the above copyright notice,
this
* list of conditions and the following disclaimer.
*
* -Redistribution in binary form must reproduce the above copyright notice,
* th... 阅读全帖
b******n
发帖数: 592
2
来自主题: Programming版 - pointer overflow
我有个void *ptr,我现要做
ptr = (ptr + 0xf) & ~0xf
C下面很简单的,一到C++就不行了,value overflow了
t****t
发帖数: 6806
3
来自主题: Programming版 - pointer overflow
of course yours won't work.
~0xf (not ~f) is type int (usually 0xfffffff0), then this int is converted
to unsigned long, where sign extension is NOT performed, which gives you (
0x00000000fffffff0), not what you wanted.
In other words, if you used reinterpret_cast, it will work. int->long
will preform sign extension, which converts ~0xf correctly to (
0xfffffffffffffff0).
The type of constant in C is sometimes incorrectly ignored.

I
late
j********g
发帖数: 244
4
恩 我也觉得是少了一个F,还有就是。。。
就比如说有16个数字要表示啊,需要2个BYTE吧,
0xF/8 是不是等于1, 那数组不该定义成 a[1], 要a[2]才够吧?
v****n
发帖数: 7841
5
来自主题: Hardware版 - HP N40L刷SYNOLOGY OS指南
upgrade到DM 4.2了,过程如下。
1,下载 DS3612xs_3202-Repack.pat , microserver-dsm-4.2.img , modules-4.2.
tar.gz
https://drive.google.com/folderview?id=0B5tpWhEINjUONzhFaEgzazU4aEU&usp=
sharing#list
2,卸下所有HDD(多于1块并且用了RAID的话,记录下顺序),连上一块儿没用的HDD在
Disk 1
3,重复lz的说明安装DM 4.2
4,安装完成后,remove刚才的Disk 1,装上原来HDD的第一块儿,注意顺序。
5,启动N40L,打开synology assitant,显示是migratable,右键点击安装,选择新的
DM4.2 pat文见(程序会自动跳过format过程)
6,安装完成开机,看看是否安装成功。
7,成功显示DM4.2以后,关机,装上剩余的HDD
8,再次开机以后,打开Storage Manager,会要求修复剩余盘的System partition,点
击修复。
9,安装完成。
其他的一... 阅读全帖
v****n
发帖数: 7841
6
来自主题: Hardware版 - HP N40L刷SYNOLOGY OS指南
upgrade到DM 4.2了,过程如下。
1,下载 DS3612xs_3202-Repack.pat , microserver-dsm-4.2.img , modules-4.2.
tar.gz
https://drive.google.com/folderview?id=0B5tpWhEINjUONzhFaEgzazU4aEU&usp=
sharing#list
2,卸下所有HDD(多于1块并且用了RAID的话,记录下顺序),连上一块儿没用的HDD在
Disk 1
3,重复lz的说明安装DM 4.2
4,安装完成后,remove刚才的Disk 1,装上原来HDD的第一块儿,注意顺序。
5,启动N40L,打开synology assitant,显示是migratable,右键点击安装,选择新的
DM4.2 pat文见(程序会自动跳过format过程)
6,安装完成开机,看看是否安装成功。
7,成功显示DM4.2以后,关机,装上剩余的HDD
8,再次开机以后,打开Storage Manager,会要求修复剩余盘的System partition,点
击修复。
9,安装完成。
其他的一... 阅读全帖
l***8
发帖数: 149
7
来自主题: Programming版 - What is "number of bits set"?
int bitCount(short input)
{
input = ((input >> 1) & 0x5555) + (input & 0x5555);
input = ((input >> 2) & 0x3333) + (input & 0x3333);
input = ((input >> 4) & 0x0707) + (input & 0x0707);
return (input >> 8) + (input & 0xf);
}
complexity is O(log(n))
b******n
发帖数: 592
8
来自主题: Programming版 - pointer overflow
Sorry, I mis-read traces from my program.
My question is: how to do bit operation on pointers in C++?
I am just trying to adjust pointers by:
ptr &= ~0xf; /* C */
can't seem to do it in C++
b******n
发帖数: 592
9
来自主题: Programming版 - pointer overflow
i didn't try 0xful, i tried
reinterpret_cast((reinterpret_cast(ptr)+0xf) & ~f))
give me very strange result. I don't know why this behave differently. Now I
implemented without bit operation and it works. I will try your method late
r and let you know if it works

)
b******n
发帖数: 592
10
来自主题: Programming版 - pointer overflow
That's why. thanks. I thought 0xf will be long as well.

long
k****t
发帖数: 2288
11
来自主题: Programming版 - 请教怎么用#define实现如下的功能
呵呵,你这个很强。
不过我很好奇的就是这个define会占instruction code的size吗?
我的想法很简单:就是简单,不容易出错,代码的size不增加。。。
比如
#include 。。。。
#define transfer(x) 。。。。
const unsigned char StrA1[] = {0xb,0xc,transfer("ABC")};
const unsigned char StrA2[] = {0xd,0xe,transfer("abcdedfg");
const unsigned char StrA3[] = {0xf,0x10,transfer("test signal");
....
(共0页)