bit

MapViewOfFile returns Error 5 (ERROR_ACCESS_DENIED)

匿名 (未验证) 提交于 2019-12-03 01:40:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to develop a system that uses shared memory for communication between two processes. One process is a 32 bit application and uses a 32bit dll for the communication. The other process is a 64 bit application and uses a 64 bit dll which contains the exact same code for creating/opening the shared memory. I made it so whenever one process opens a handle to the memory and cannot open it, it automatically tries to create the memory. The other process will then try the same so whichever process runs the code first will create the memory

What is Bit Masking?

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am fairly new to C programming, and I encountered bit masking. Can someone explain to me the general concept and function of bit masking? Examples are much appreciated. 回答1: A mask defines which bits you want to keep, and which bits you want to clear. Masking is the act of applying a mask to a value. This is accomplished by doing: Bitwise ANDing in order to extract a subset of the bits in the value Bitwise ORing in order to set a subset of the bits in the value Bitwise XORing in order to toggle a subset of the bits in the value Below is an

The application was unable to start correctly (0xc000007b)

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a client/server app which I have been developing on a single PC. Now it needs two serial ports, so I borrowed a PC from a friend. When I build my app and try to run or debug it (whether in the Delphi IDE or from Windows File manager), it errors "The application was unable to start correctly (0xc000007b)". Googling doesn't bring up much, but seems to indicate that this is nothing Delphi specific and happens with other apps. It seems to be caused by calling into a 32 bit DLL from a 64 bit app or vice versa. both PCs are Windows 7, 64

What is CHAR_BIT?

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Quoting the code for computing the integer absolute value (abs) without branching from http://graphics.stanford.edu/~seander/bithacks.html : int v; // we want to find the absolute value of v unsigned int r; // the result goes here int const mask = v >> sizeof(int) * CHAR_BIT - 1; r = (v + mask) ^ mask; Patented variation: r = (v ^ mask) - mask; What is CHAR_BIT and how use it? 回答1: You should be aware that this code depends on the implementation-defined behavior of right bitshift on signed types. gcc promises to always give the sane behavior

How can I call ActivateKeyboardLayout from 64bit Windows Vista using VBA

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Running VBA under XP I was able to call ActivateKeyboardLayout to switch my input language from English to another language. However, this no longer works under Vista64. Any suggestions or workarounds? The code that used to work under XP was similar to the following: Private Declare Function ActivateKeyboardLayout Lib "user32" ( _ ByVal HKL As Long, ByVal flags As Integer) As Integer Const aklPUNJABI As Long = &H4460446 ActivateKeyboardLayout aklPUNJABI, 0 There was a suggestion to try Public Declare Function ActivateKeyboardLayout Lib

Convert Raw 14 bit Two's Complement to Signed 16 bit Integer

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am doing some work in embedded C with an accelerometer that returns data as a 14 bit 2's complement number. I am storing this result directly into a uint16_t . Later in my code I am trying to convert this "raw" form of the data into a signed integer to represent / work with in the rest of my code. I am having trouble getting the compiler to understand what I am trying to do. In the following code I'm checking if the 14th bit is set (meaning the number is negative) and then I want to invert the bits and add 1 to get the magnitude of the

What is the size of integer in 8-bit, 16-bit, 32-bit processors/microcontrollers?

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: What is the size of integer in 8-bit, 16-bit, 32-bit processors/microcontrollers ? I guess it depends on the internal accumulator/register size. But not sure. Thanks 回答1: I'm only aware of one programming language that defines an integer data type, but it's seldom used for 8 and 16-bit architectures. C is the most widely used language for programming 8-bit, 16-bit, and 32-bit architectures, so I assume you are looking for an answer in the context of C. There are several "integer" data types in C: char , short , int , long , etc...,

Why if (n & -n) == n then n is a power of 2?

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Line 294 of java.util.Random source says if (( n & - n ) == n ) // i.e., n is a power of 2 // rest of the code Why is this? 回答1: The description is not entirely accurate because (0 & -0) == 0 but 0 is not a power of two. A better way to say it is ((n & -n) == n) when n is a power of two, or the negative of a power of two, or zero. If n is a power of two, then n in binary is a single 1 followed by zeros. -n in two's complement is the inverse + 1 so the bits lines up thus n 0000100. .. 000 - n 1111100. .. 000 n & - n 0000100. .. 000

Can 64 bit Delphi targets statically link to compiled C object files?

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: My 32 bit Delphi 2010 application links to a number of C object files using the $LINK compiler directive. Can I do this in Delphi XE2 when targetting 64 bit? I am currently compiling using bcc32 version 5.5, but I don't mind which compiler I use if it turns out that the Embarcadero C compiler does not yet output 64 bit objects. 回答1: Yes. You must compile the "C" objects files to COFF format. This usually means either the Intel and/or MSVC++ compilers. The same caveats apply to 64bit object file linking that apply to 32bit. You must

What is the difference between -Xss and -XX:ThreadStackSize?

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I just want to control the stack size for all of my threads in a Java (groovy) application. For the Hotspot Oracle VM, I know that there are two parameters doing that ( -Xss and XX:ThreadStackSize ). Which is the preferred one? Is there any difference between them? Regarding Open JDK 7 someone asked on the mailing list , stating that -Xss is the same for the Hotpot VM as -XX:ThreadStackSize . The point is, that I am measuring how many threads can be started on my system. My groovy script which does this looks like: int count = 0