Windows XP,Vista和7在开发方面的主要差异[关闭](Which Is The Major Differences Between Windows XP, Vista And 7 At The Development Side [closed])
最近我在我的开发机器上安装了Windows 7进行测试,用它安装了Visual Studio 2010,但我在考虑Windows XP , Windows Vista和Windows 7的开发之间的主要区别是什么? Net Framework 4?
Recently I installed Windows 7 in my development machine just to test, with it I installed Visual Studio 2010, but I was thinking in what are the major differences between the development for/under Windows XP, Windows Vista and Windows 7?, how about .Net Framework 4?
原文:https://stackoverflow.com/questions/1658754
最满意答案
首先,它不反转位,它反转它们(只有最右边的位和最左边的位之间的位置设置为1)。
其次,它是如何工作的:
int binaryReverse(int toReverse) { int reversed = 0; while (toReverse > 0) { reversed *= 2; // shift the output one bit to the left reversed += toReverse % 2; // set the rightmost bit in the output to the value of the rightmost bit in the input toReverse /= 2; // shift the input one bit to the right } return reversed; }
第三,这是一个可能更易读的版本(虽然它必须将输入视为
unsigned
):int binaryReverse(unsigned int toReverse) { int reversed = 0; while (toReverse > 0) { reversed <<= 1; // shift the output one bit to the left reversed |= toReverse & 1; // set the rightmost bit in the output to the value of the rightmost bit in the input toReverse >>= 1; // shift the input one bit to the right } return reversed; }
First of all, it doesn't invert the bits, it reverses them (and only those between the rightmost bit and the leftmost bit which is set to 1).
Second, here is how it works:
int binaryReverse(int toReverse) { int reversed = 0; while (toReverse > 0) { reversed *= 2; // shift the output one bit to the left reversed += toReverse % 2; // set the rightmost bit in the output to the value of the rightmost bit in the input toReverse /= 2; // shift the input one bit to the right } return reversed; }
Third, here is a possibly more readable version (though it has to take the input as
unsigned
):int binaryReverse(unsigned int toReverse) { int reversed = 0; while (toReverse > 0) { reversed <<= 1; // shift the output one bit to the left reversed |= toReverse & 1; // set the rightmost bit in the output to the value of the rightmost bit in the input toReverse >>= 1; // shift the input one bit to the right } return reversed; }
相关问答
更多-
这就是汉明体重问题,也就是人口数量。 该链接提到了有效的实现。 引用: 使用无限的内存,我们可以简单地创建一个大的每个64位整数汉明权重的查找表 That's the Hamming weight problem, a.k.a. population count. The link mentions efficient implementations. Quoting: With unlimited memory, we could simply create a large lookup table of ...
-
如何在数字的二进制表示中找到1的数量?(How to find the number of 1's in a binary representation of a number?)[2022-04-20]
尝试这个 var binary = 10; var result = binary.toString(2); //Converts to binary var count = result.split(1);// count -1 is your answer alert((result.split('1').length-1)); 也可以写成 (binary.toString(2).split('1').length-1) toString(2) : helps to split it in a ... -
在Matlab中,可以使用Java JDK函数。 将Matlab中的float(单精度32位数)转换为二进制字符串表示的简短答案可能是: flt=3.14 import java.lang.Integer java.lang.Float; Integer.toBinaryString(Float.floatToIntBits(flt)) 答案很长:在Matlab中将float(单精度32位数)转换为二进制字符串表示 function out=float2binstring(flt) % converts ...
-
使用CONV(..., 10, 16)将数字从基数10转换为基数16。 拿到这个结果并留下最多16个0: LPAD(..., 16,'0') 以十六进制编码的字符串并转换为二进制与UNHEX(...) 所以你的表达式是UNHEX(LPAD(CONV(/* input value or column here */,10,16),16,'0')) 。 使用HEX()函数将八位字节转换回十六进制以便我们可以看到结果的示例: mysql> SET @input = 9; SET @output = UNHEX(L ...
-
二进制re的二进制表示(binary representation of binary re)[2022-11-07]
这是我的头脑,应该足够快到大多数目的。 适用于价值高达1,048,575的价值。 using System; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { checked { uint i = 0; while (true) ... -
使用chr函数: socket_write( $fp, chr(15)); 您还可以使用带有十六进制值的\x转义符: socket_write( $fp, "\xff\xff\xff\xff" ); 将发送4个字节,每个字节的值为255。 Use the chr function: socket_write( $fp, chr(15)); You can also use \x escapes with hex values: socket_write( $fp, "\xff\xff\xff\xff" ...
-
理解反转偶数二进制表示的函数(Understanding function which inverts binary representation of even number)[2024-01-31]
首先,它不反转位,它反转它们(只有最右边的位和最左边的位之间的位置设置为1)。 其次,它是如何工作的: int binaryReverse(int toReverse) { int reversed = 0; while (toReverse > 0) { reversed *= 2; // shift the output one bit to the left reversed += toReverse % 2; // ... -
由于这是家庭作业,我只会给你一些提示。 这两个问题是无关的,所以你需要两种方法:toBinary和fib。 toBinary (fib (n)); 将是你的解决方案。 为了解决toBinary部分,除法和模数是有用的,可以递归调用。 如果你计算fib(n)为fib(n-1)+ fib(n-2),就会有一个陷阱进入,当你计算fib(n-1)为fib(n-2)+ fib时( n-3),你最终计算两次fib(n-2),fib(n-3)三次,依此类推。 相反,你应该从(0 + 1)开始向上步,向前传递已经计算过的。 ...
-
打印文件的二进制表示(Print binary representation of file)[2024-04-27]
我通常不相信用完整的代码实现来回答这些问题,但是多年前我被交给了这段代码,我觉得有义务将其传递给我。 除了用法之外,我删除了所有注释,因此您可以尝试自己弄清楚它是如何工作的。 代码库16 #include#include // Takes a pointer to an arbitrary chunk of data and prints the first-len bytes. void dump (void* data, unsigned int len) { ... -
一个简单的方法: #include
int absdiffevenoddpopcount(uint64_t x) { uint64_t a = x & 0x5555555555555555; uint64_t b = x & ~0x5555555555555555; while(a && b) { a &= a - 1; b &= b - 1; } x = a ? a : b; int r = 0; ...