processor

size of int variable

99封情书 提交于 2019-11-27 05:30:45
How the size of int is decided? Is it true that the size of int will depend on the processor. For 32-bit machine, it will be 32 bits and for 16-bit it's 16. On my machine it's showing as 32 bits, although the machine has 64-bit processor and 64-bit Ubuntu installed. It depends on the implementation. The only thing the C standard guarantees is that sizeof(char) == 1 and sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long) and also some representable minimum values for the types, which imply that char is at least 8 bits long, int is at least 16 bit, etc. So it must

How is arctan implemented?

纵然是瞬间 提交于 2019-11-27 01:38:39
问题 Many implementation of the library goes deep down to FPATAN instuction for all arc-functions. How is FPATAN implemented? Assuming that we have 1 bit sign, M bits mantissa and N bits exponent, what is the algorithm to get the arctangent of this number? There should be such algorithm, since the FPU does it. 回答1: Trigonometric functions do have pretty ugly implementations that are hacky and do lots of bit fiddling. I think it will be pretty hard to find someone here that is able to explain an

CPU and Data alignment

旧时模样 提交于 2019-11-27 01:37:51
Pardon me if you feel this has been answered numerous times, but I need answers to the following queries! Why data has to be aligned (on 2-byte / 4-byte / 8-byte boundaries)? Here my doubt is when the CPU has address lines Ax Ax-1 Ax-2 ... A2 A1 A0 then it is quite possible to address the memory locations sequentially. So why there is the need to align the data at specific boundaries? How to find the alignment requirements when I am compiling my code and generating the executable? If for e.g the data alignment is 4-byte boundary, does that mean each consecutive byte is located at modulo 4

Determine word size of my processor

丶灬走出姿态 提交于 2019-11-27 01:02:33
How do I determine the word size of my CPU? If I understand correct an int should be one word right? I'm not sure if I am correct. So should just printing sizeof(int) would be enough to determine the word size of my processor? Your assumption about sizeof(int) is untrue; see this . Since you must know the processor, OS and compiler at compilation time, the word size can be inferred using predefined architecture/OS/compiler macros provided by the compiler. However while on simpler and most RISC processors, word size, bus width, register size and memory organisation are often consistently one

What's the difference between a single precision and double precision floating point operation?

。_饼干妹妹 提交于 2019-11-26 23:45:02
问题 What is the difference between a single precision floating point operation and double precision floating operation? I'm especially interested in practical terms in relation to video game consoles. For example, does the Nintendo 64 have a 64 bit processor and if it does then would that mean it was capable of double precision floating point operations? Can the PS3 and Xbox 360 pull off double precision floating point operations or only single precision and in general use is the double precision

Getting processor information in Python

主宰稳场 提交于 2019-11-26 22:22:53
Using Python is there any way to find out the processor information... (I need the name) I need the name of the processor that the interpreter is running on. I checked the sys module but it has no such function. I can use an external library also if required. The platform.processor() function returns the processor name as a string. >>> import platform >>> platform.processor() 'Intel64 Family 6 Model 23 Stepping 6, GenuineIntel' Here's a hackish bit of code that should consistently find the name of the processor on the three platforms that I have any reasonable experience. import os, platform,

Processor, OS : 32bit, 64 bit

扶醉桌前 提交于 2019-11-26 22:19:20
问题 I am new to programming and come from a non-CS background (no formal degree). I mostly program winforms using C#. I am confused about 32 bit and 64 bit.... I mean, have heard about 32 bit OS, 32 bit processor and based on which a program can have maximum memory. How it affects the speed of a program. There are lot more questions which keep coming to mind. I tried to go through some Computer Organization and Architecture books. But, either I am too dumb to understand what is written in there

How to check in Rust if architecture is 32 or 64 bit?

﹥>﹥吖頭↗ 提交于 2019-11-26 21:51:56
问题 If there a conditional check for whether processor is 32-bit or 64-bit? I'm looking for kind of configuration check like e.g. #cfg[x86] or cfg[x64] . 回答1: The #[cfg(target_pointer_width = "64")] from the cfg section in the Rust reference seems like a likely solution. It is based on the size of a pointer (as well as isize and usize ), which should correspond to the architecture. 回答2: You should check the Rust Reference chapter on conditional compilation: target_arch = "..." - Target CPU

django request in template

安稳与你 提交于 2019-11-26 21:46:14
问题 I've enabled the django request processor TEMPLATE_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", ) Still i don't have to request variable available in templates. I've to manually pass it. Using django 1.0.2 Everywhere on web it seems it's only about enabled request processor.. Also i am using RequestContext as : return render

How to get CPU usage statistics on Android?

岁酱吖の 提交于 2019-11-26 19:30:03
问题 I want to get the overall CPU usage on Android, similar to what Windows' Task Manager does. I can parse the output of the top program included in Android, but if there is a API call that does the same thing, it would be better. Any pointers? 回答1: ATTENTION : This answer is old and does NOT work on newer versions of Android due to enhanced security mechanisms. For complete CPU usage (not for each process) you can use: /** * * @return integer Array with 4 elements: user, system, idle and other