由买买提看人间百态

topics

全部话题 - 话题: int16
(共0页)
l*********r
发帖数: 674
1
来自主题: JobHunting版 - Google 电话面试被拒
什么叫reverse bit (16 bits)? 是把一个int16 bit-wise reverse么?
u****u
发帖数: 229
2
来自主题: JobHunting版 - 请问一个little endian 系统的问题
1) 移位操作和endianess没有一点关系.
2) unsigned int32 a=0x000000ff, unsigned int16 b=0x00ff.和endianess没有一点
关系.
3) 为什么我们说C语言不好?问题就是在于有太多的类似的概念不清的新手上来就用C.
O******i
发帖数: 269
3
来自主题: JobHunting版 - atoi很不好写,头都大了...
写了一个,要考虑的情况真多...
假定是16位整数,范围是-32768到+32767
bool my_atoi(const char* str, int16& num)
{
if (str == NULL || str[0] == '\0')
return false;
int i = 0;
bool IsNeg = (str[0] == '-')? true : false;
if (str[0] == '+' || str[0] == '-')
{
if (str[1] == '\0')
return false;

i = 1;
}
num = 0;
const int num_limit = 3276;
const int digit_limit = (IsNeg)? 8 : 7;
int digit = 0;
bool max_int_reached = false;
for (; str[... 阅读全帖
e***s
发帖数: 799
4
public static int JumpGameII(int[] A)
{
if (A.Length <= 1)
return 0;
int[] MinJumps = new int[A.Length];
MinJumps[0] = 0;
for (int i = 1; i < A.Length; i++)
{
int Min = Int16.MaxValue;
for (int j = 0; j < i; j++)
{
if (MinJumps[j] >= Min)
continue;
if (A[j] >= i - j)
Min = Math.M... 阅读全帖
e***s
发帖数: 799
5
public static int JumpGameII(int[] A)
{
if (A.Length <= 1)
return 0;
int[] MinJumps = new int[A.Length];
MinJumps[0] = 0;
for (int i = 1; i < A.Length; i++)
{
int Min = Int16.MaxValue;
for (int j = 0; j < i; j++)
{
if (MinJumps[j] >= Min)
continue;
if (A[j] >= i - j)
Min = Math.M... 阅读全帖
l***g
发帖数: 1035
6
来自主题: JobHunting版 - 说说python
出个题
in python, 把一个16位数interpret成int16, uint16, split to 2 int8.
c***k
发帖数: 1589
7
来自主题: Apple版 - 好吧s,10.6.3蓝屏
恩,因为我遇见过很多次,我怕说出来被扣大帽子。我觉得Mac OS对一些极端情况和
edge case还是
控制的不好,我又是经常把系统给搞得很疲惫的那种……
10.6.3修了一个我们嚷嚷了很久的bug,说出来蛮有趣的,Apple event的id超过65535
就会重复,
原因内部他们用的是int16
z*y
发帖数: 1311
8
来自主题: ComputerGraphics版 - JPEG2000 Question
Thanks, but not work very well.
I use C.
Here is the code I generate data.
FILE *f_out = fopen("LL.dat", "wb");
fwrite(LL, sizeof(short int), 256*256, f_out);
fclose(f_out);
Then I try Matlab.
f = fopen('LL.dat', 'rb');
d = fread(f, [256,256], 'int16');
imwrite(d, 'LL.jpg', 'jpg', 'BitDepth', 16, 'Mode', 'lossless');
imwrite(d, 'LL.png', 'png', 'BitDepth', 16);
The image is not right. BTW, data LL is correct.
I verify using other ways.
Thank you for the help.
s****c
发帖数: 11300
9
来自主题: Hardware版 - 64位系统怎么调32位系统的存档
对的
linux下面我程序写的少 一般windows下面我就不用float这样的东西了 直接int8
int16类似的
t****t
发帖数: 6806
10
来自主题: Hardware版 - 64位系统怎么调32位系统的存档
这个, 人家要是需要用float的话是没办法用int16代替的吧.
d****i
发帖数: 4809
11
来自主题: Programming版 - C问题,被64bit iPhone搞晕了
所以比较好的方法是,针对不同的处理器,采用头文件types.h来自定义:
#ifdef _ARM_CORTEX
typedef int INT32;
typedef unsigned int UINT32;
typedef short INT16;
......
#endif
d****n
发帖数: 1637
12
来自主题: Programming版 - 为什么大家不喜欢golang的switch?
switch is fine.
not using switch is only MY choice.
Most functions return very few types of known errors.(one or two)
one is the best or two.
for an example, strconv.ParseInt
if err== strconv.ErrSyntax {
// tell user format wrong
return
}
if err == strconv.ErrRange{
//maybe panic cause you system can not handle bigger than int32
}
it doesn't matter using a switch or if.
error is not C pointer NULL, which doesn't tell any thing.
error is not exception, which you always don't expect it valu... 阅读全帖
b***i
发帖数: 3043
13
来自主题: Programming版 - C++11使用感受及一些问题
我的嵌入式是666MHz ARM双核心,1GB内存,Linux 3.17,所以,新特性很多可以用上
。比如,thread, auto, 确定长度的整形变量类型int16, std::move, Lambda, 统一
的初值和矩阵赋初值格式, nullptr, Delegating Constructors(这个和Java一样了),
就好像手机是不是嵌入式,它和服务器台式机编程有多大不同?我前面说过,我宁愿用
Java,现在发现C++11已经很像Java了。
z****e
发帖数: 54598
14
来自主题: Programming版 - 我来一个系统比老魏出票多。

别丢人了好吧?并发访问峰值上千万
然后一天峰值是297亿
老魏那种简化版的东西实在是不值得看啊
连车次什么都是int啊
人家车次好歹是k什么什么,t什么什么
你见过123次的吗?
还有车站也是int16,我靠
在这种地方抠门,好意思么?
z****e
发帖数: 54598
15
来自主题: Programming版 - 100%和必需出票属于没戏了

车站啊
你们自己定义的车站是int16
到现在自己都看不懂
我靠,谁让你这样定义的?
z****e
发帖数: 54598
16

你觉得现实中票的操作就是内存中做一个标记那么简单是吧?
你给我找出来,什么票是内存中的int16的赋值操作
你找出来,哪怕是加拿大的灰狗都没有这么简单
(共0页)