32-bit

PHP bitwise AND (&) returns negative number

梦想与她 提交于 2019-12-13 10:24:57
问题 The code: echo (5243960811416 & 4040906070209050); Try on http://phptester.net/ and the result (right) will be 20407554584 but on my web hosting it gives -1067281896 . There's any workaround to have 20407554584 ? It's a 32bit limit? Thanks UPDATE /w SOLUTION 回答1: SOLUTION After searchs and searchs I found this and I re-convert in PHP function BitwiseAndLarge($val1, $val2) { $shift = 0; $result = 0; $mask = ~((~0) << 30); // Gives us a bit mask like 01111..1 (30 ones) $divisor = 1 << 30; // To

Counting the binary digits of a signed 32-bit integer in c programming

南楼画角 提交于 2019-12-13 09:48:21
问题 I have following function which counts the number of binary digits in an unsigned 32-bit integer. uint32_t L(uint32_t in) { uint32_t rc = 0; while (in) { rc++; in >>= 1; } return(rc); } Could anyone tell me please in case of signed 32-bit integer, which approach i should take ? implementing two's complement is an option. if you have any better approach, please let me know. 回答1: What about: uint32_t count_bits(int32_t in) { uint32_t unsigned_in = (uint32_t) in; uint32_t rc = 0; while (unsigned

Determine number of negative and positive numbers in an array

Deadly 提交于 2019-12-13 07:38:19
问题 I need to determine the number of negative and positive numbers in an array in assembler. It seems that the assembler doesn't recognizes them as negative numbers. How can I solve this problem? I define the array this way: word_array db 3, -2, 11, -1, -2, -7, -5, -20 I have this function that counts the positive ones: count_positives: mov dx, word [word_array + 2*ecx - 2] cmp edx, 0 JL skip inc ebx skip: loopnz count_positives 回答1: Count either negative or non-negative, and subtract that from

How to check if a number represents an uppercase character in NASM Assembly?

冷暖自知 提交于 2019-12-13 04:47:07
问题 Suppose that you have a number stored in EAX . How can I check whether this number represents an uppercase character or not? Frankly, I haven't tried anything. The closest idea I had was to create an array of upper case characters ('A','B','C,'D',...) and then check if EAX was equal to any of these. Is there a simpler way to do this in NASM Assembly? I'm using 64-bit CentOS, for a 32-bit program. 回答1: For ASCII characters, something like this would work: cmp eax,'A' setnc bl ; bl = (eax >= 'A

Building crti.o for i386

£可爱£侵袭症+ 提交于 2019-12-13 03:54:55
问题 I am trying to build a cross-compiler with x86_64 being the host and i386 being the target. I'm getting the (all to common) crti.o: No such file error. Instead of grabbing an already built crti.o and crtn.o from a distro... how might I go about building these files explicitly from glibc (or possibly gcc) sources? FYI, I am well aware of the -m32 option for x86_64 compilers. I'd prefer to just have a 32bit-only compiler environment. Also, the reason I don't want to use any of the gazillion

What's the algorithm to translate 8 byte memory into a double number on x86 32bit?

别说谁变了你拦得住时间么 提交于 2019-12-13 02:54:35
问题 So basically I disassemble some code on 32bit Linux and in the rodata section, where double should exist, I find these 8 bytes: 00000000 00002440 The original double number is 10.0 Could anyone tell me how to transform this 8 bytes into double? 回答1: Put the bytes into a buffer and ask C to interpret the memory as a double. #include <stdio.h> int main(){ char* foo = "\x00\x00\x00\x00\x00\x00\x24\x40"; double bar =*((double*) foo); printf("%f\n", bar); } Output: 10.000000 来源: https:/

.NET 3.5 Web Application - Porting to 64Bit - Potential issues

匆匆过客 提交于 2019-12-13 02:08:12
问题 I have an existing ASP.net 3.5 web application. This is tested and working in a 32 bit environment. There is a plan to move this application to a 64 bit environment. As a first step, the plan is to compile the entire application in "Any CPU" Is anyone aware of any plan / checklists that can be used in porting from 32-bit to 64-bit? As the hardware is still in procurement, it will be a while before the actual system testing will start and hence we want to try and minimize the amount of issues

How do I get another counter?

≯℡__Kan透↙ 提交于 2019-12-13 02:06:53
问题 I'm trying to compare bubble sort between C++ and MASM. I've got the C++ working without issue. With MASM, however, I need another counter in loopSwap, but I don't know how to go about it. I know that if I push a register, it would have to be before the comparison but if the comparison jump is met, I wouldn't be able to pop the same register. Any help is appreciated! C++ Code: #include <iostream> #include <cmath> #include <ctime> using namespace std; int deepBlueDecend(int* num, int size);

How to enumerate all installed usb modem using Windows API

不问归期 提交于 2019-12-12 15:27:18
问题 I have bought a ZTE MF190 usb modem and began to harness it. So far, I have managed to programmatically have an sms sent to another mobile equipement using free AsyncPro components of TurboPowers . I wonder wether there is a way to retrieve the list of all installed modems along with their attached serial COM ports (hopefully with other valuable capabilities). Thanks in advance. 回答1: To list the installed modems you can use the Win32_POTSModem WMI class Check this sample code. {$APPTYPE

How to determine location of 32BIT Java

点点圈 提交于 2019-12-12 10:14:44
问题 Since some days the JRE is installed in a version specific directory [1]. So I tried to write a DOS batch or VBS script to determine the location of the latest installed JRE 8 32 bit. But when checking the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft" i noticed that this contains only information regarding the 64 Bit Java Runtime. So any idea how to determine the location of the latest installed 32 Bit Java Runtime via DOS or vbs? This should also consider that a 64 Bit version might be