MySQL处理两个整数(INT)相减的时候,如果其中有一个是UNSIGNED INT类型的,那么结果就被当做是UNSIGNED的。
如果相减的结果是负数:
在MySQL 5.5.5之前,结果变成了最大的整数(18446744073709551615)从MySQL 5.5.5开始,这种情况会返回一个错误:BIGINT UNSIGNED value is out of range....
分类:
数据库 时间:
2015-08-04 19:13:01
阅读次数:
200
思路一:x,1 x,2 x,4 x,8 x,16依次往上加,再往下减 5=1+2+2,这种方法不好思路二:利用5=101=4+1=(2,2)+(2,0),很巧妙 double res = 1.0; bool flag = false; unsigned int newn...
分类:
其他好文 时间:
2015-08-04 10:56:56
阅读次数:
120
实现一个Memcpy函数。
Memcpy函数用于 把资源内存(src所指向的内存区域) 拷贝到目标内存(dest所指向的内存区域);
拷贝多少个?有一个size变量控制拷贝的字节数。
函数原型:void *memcpy(void *dest, void *src, unsigned int count);
用法:(1)可以拷贝任何类型的对象,因为函数的参数类型是void*(未定义类型指针)...
分类:
编程语言 时间:
2015-08-04 09:26:23
阅读次数:
203
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-08-04 02:01:23
阅读次数:
93
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in...
分类:
其他好文 时间:
2015-08-04 00:16:38
阅读次数:
102
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in...
分类:
其他好文 时间:
2015-08-03 22:16:35
阅读次数:
144
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-08-03 22:14:10
阅读次数:
172
一 表结构如下:MySQL 5.5.30 5.6.20版本,表大概有815万行CREATE TABLE t_audit_operate_log ( Fid bigint(16) AUTO_INCREMENT, Fcreate_time int(10) unsigned NOT NULL DEFAUL...
分类:
数据库 时间:
2015-08-03 16:19:10
阅读次数:
201
1. 问题引入:开两个线程同时对一个全局变量10万次做自加,结果会如何?
#include
#include
#include
unsigned int g_cn = 0;
void* thread_proc (void* arg) {
unsigned int i;
for (i = 0; i < 100000; i++)
++g_cn;
return NULL;
}
...
分类:
编程语言 时间:
2015-08-02 23:27:26
阅读次数:
165
#include int main(){ int a[5] = {1, 2, 3, 4, 5}; int* p1 = (int*)(&a + 1); // (unsigned int)&a+sizeof(*&a) => 整个数组后面的那个地址 int* p2 = (int*)((...
分类:
编程语言 时间:
2015-08-02 15:05:28
阅读次数:
106