Windows error 0x7FFFFFFF, 2147483647

Detailed Error Information

HRESULT analysis[1]

FlagsSeveritySuccess

This code indicates success, rather than an error. This may not be the correct interpretation of this code, or possibly the program is handling errors incorrectly.

Reserved (R)true
OriginCustomer

This code was defined by a third party software company, and may mean different things for different software. Contact the software author for more information about this error.

NTSTATUStrue
Reserved (X)true
FacilityCode4095 (0xfff)
Error Code65535 (0xffff)

Questions

104votes
10answers

How does Python manage int and long?

Does anybody know how Python manage internally int and long types? * Does it choose the right type dynamically? * What is the limit for an int? * I am using Python 2.6, Is is different with previous versions? How should I understand the code below? >>> print type(65535) <type [...] read more
python
integer
65votes
2answers

Performance difference between Windows and Linux using Intel compiler: looking at the assembly

I am running a program on both Windows and Linux (x86-64). It has been compiled with the same compiler (Intel Parallel Studio XE 2017) with the same options, and the Windows version is 3 times faster than the Linux one. The culprit is a call to std::erf which is resolved [...] read more
c++
assembly
x86-64
icc
vtune
32votes
5answers

Efficient integer floor function in C++

I want to define an efficient integer floor function, i.e. a conversion from float or double that performs truncation towards minus infinity. We can assume that the values are such that no integer overflow occurs. So far I have a few options * casting to int; this requires special handling [...] read more
c++
performance
x86-64
processing-efficiency
floor
23votes
6answers

Why is Int32's maximum value 0x7FFFFFFF?

I saw in MSDN documents that the maximum value of Int32 is 2,147,483,647, hexadecimal 0x7FFFFFFF. I think, if it's Int32 it should store 32-bit integer values that finally should be 4,294,967,295 and hexadecimal 0xFFFFFFFF. My question is why Int32 stores 31-bit integer values? read more
c#
types
int32
14votes
8answers

C macro to create a bit mask -- possible? And have I found a GCC bug?

I am somewhat curious about creating a macro to generate a bit mask for a device register, up to 64bits. Such that BIT_MASK(31) produces 0xffffffff. However, several C examples do not work as thought, as I get 0x7fffffff instead. It is as-if the compiler is assuming I want signed output, [...] read more
c
bit-manipulation
11votes
3answers

point of IT instruction ARM assembly

I've got the following ARM assembly code. CMP R0, #0 ITT EQ MOVEQ R0, #0x7FFFFFFF BXEQ LR Firstly, why is the EQ needed after the MOV and BX instructions? The ARM reference says that the condition (EQ) after the ITT will be applied to the first instruction (MOV) in the [...] read more
assembly
arm
9votes
7answers

What is the value of ~0 in C?

I want to get the values of INT_MIN and INT_MAX. I've tried ~0 and ~0 >> 1 since the leftmost bit is a sign bit but I got -1 for both of them. It's so confused that why ~0 doesn't turn out to be 0xffffffff and ~0 >> 1 to [...] read more
c
bit-manipulation
9votes
0answers

Clang 8 with MinGW-w64: How do I use address- & UB sanitizers?

Clang 8 release notes have this promising line: > * Allow using Address Sanitizer and Undefined Behaviour Sanitizer on MinGW. However, I unable to figure out how to use those properly. I'm using Clang 8.0.0 with MSYS2 MinGW GCC. Exact details are at the bottom of the question. I'm trying [...] read more
c++
clang
mingw-w64
address-sanitizer
ubsan
8votes
5answers

QSpinBox with Unsigned Int for Hex Input

There are a variety of questions written here about QSpinBox's limitation of using an int as its datatype. Often people want to display larger numbers. In my case, I want to be able to show an unsigned 32bit integer in hexadecimal. This means I'd like my range to be [0x0, [...] read more
c++
qt
hex
unsigned-integer
qspinbox
8votes
3answers

Java Integer.MAX_VALUE vs Kotlin Int.MAX_VALUE

I noticed, one interesting thing. Java's Integer.MAX_VALUE is 0x7fffffff (2147483647) Kotlin's Int.MAX_VALUE is 2147483647 but if you write in Java: int value = 0xFFFFFFFF; //everything is fine (but printed value is '-1') in Kotlin: val value: Int = 0xFFFFFFFF //You get exception The integer literal does not conform to the [...] read more
java
kotlin
7votes
4answers

Maximum Product of Three Numbers

I am trying to solve this problem from leetcode, going to copy here for convenience Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 Note: The length of the given array [...] read more
python
algorithm
python-2.7
7votes
1answer

Generate a 10-digit TOTP password with a certain key

This problem is related to TOTP as specified in RFC6238 here: https://tools.ietf.org/html/rfc6238#section-1.2. I am to implement the RFC6238 to generate a 10-digit TOTP password, which will be used in a POST request later on. The sample input and output for the TOTP is supposed to be like this: Sample Input: [...] read more
java
encryption
hmac
password-encryption
one-time-password
6votes
3answers

JPanel in puzzle game not updating

I have a simple puzzle game. There is an image consisting of 16 tiles (randomly placed). Images are stored in an array and when game is launched they're added to main JPanel. alt text [https://i.stack.imgur.com/2JP85.gif] Game works in this way : Each image has atributes 'place' and 'number'. 'Place' is [...] read more
java
swing
5votes
1answer

"Anomaly" in signed integer in C

I'm currently writing a lecture on ARM optimization, specifically on vector machines such as NEON as the final target. And since vector machines don't fare well with if-else slaloms, I'm trying to demonstrate how to get rid of them by bit-hacking. I picked the "saturating absolute" function as an example [...] read more
c
optimization
integer
arm
bit-manipulation
5votes
2answers

why floor, ceil implementation return x + x when x is NaN or inf?

I'm reading IEEE-754 math functions' implementation in glibc. Here is floor implementation. float __floorf(float x) { int32_t i0,j0; uint32_t i; GET_FLOAT_WORD(i0,x); j0 = ((i0>>23)&0xff)-0x7f; if(j0<23) { if(j0<0) { /* return 0*sign(x) if |x|<1 */ if(i0>=0) {i0=0;} else if((i0&0x7fffffff)!=0) { i0=0xbf800000;} } else { i = (0x007fffff)>>j0; if((i0&i)==0) return x; /* [...] read more
c
glibc
ieee-754
floor
4votes
3answers

Why is the (signed) cast necessary only sometimes to represent the minimum integer (32 bit system)?

I recently found this code: for (i = 0; i < k; i ++) { b[i] = 0x80000000; // min integer s[i] = 0; } the above is part of this program: int _max(int a, int b) { return a > b ? a : b; } int all_profits(int* prices, [...] read more
c
4votes
4answers

32-bit / 16-bit signed integer division without 32-bit registers?

I'm trying to divide a 32-bit signed integer by a 16-bit signed integer to get a signed 32-bit quotient and 16-bit remainder. I'm targeting a 286 with no fpu. I've already written code in the past to do 32-bit unsigned division: DIV32 PROC ;DIVIDES A 32-BIT VALUE BY A 16-BIT [...] read more
assembly
x86-16
integer-division
4votes
1answer

**polygon.setfillcolor(Color)** not working for google map v2

I am adding a Polygon into Google Map v2 like this: for (int index = coordinats.size()-1; index >= 0; index--) { polygonOptions.add( new LatLng(latCoordinats.get(index), lngCoordinats.get(index))); } polygonOptions.strokeColor(0x7FFFFFFF); polygonOptions.strokeWidth((float) 5); polygonOptions.fillColor(Color.BLUE); polygon= mMap.addPolygon(polygonOptions); > polygonOptions.fillColor(Color.BLUE); is not working for me... What am i missing? read more
android
google-maps
polygons
4votes
1answer

Why is glibc's __random_r assigning variables it immediately overwrites?

I was looking for the source for glibc's rand() function, which an answer here links to. Following the link, I'm puzzled about the code for the __random_r() TYPE_0 branch: int32_t val = state[0]; val = ((state[0] * 1103515245) + 12345) & 0x7fffffff; state[0] = val; *result = val; What is [...] read more
c
random
glibc
4votes
3answers

spring.data.rest.max-page-size does not seem to work?

Under Boot 1.3.0.M5 i use in application.properties spring.data.rest.max-page-size=10 But i still can set the size to 40 in a URL and get a correct response. For example : http://localhost:8080/cine20-spring/api/films?page=0&size=40&sort=title,asc will give me back 40 films So what is the use of this parameter ? Update test with Spring-Boot 1.4.2 There [...] read more
spring-data-rest
4votes
1answer

how to implement the % operator for unsigned integer?

How to implement the % operator or function for lua's unsigned integer? I thought of using type cast to float, but precision is a problem. function ModU(a, b) if b == 0 then return a end if a == 0 then return 0 end if b < 0 then if [...] read more
lua
modulo
3votes
6answers

Why/how does gcc compile the undefined behaviour in this signed-overflow test so it works on x86 but not ARM64?

I was self-studying CSAPP and got a strange result when I ran into a strange issue during the run of a assertion test. I'm not sure what to start this question with, so let me get the code first (file name visible in comments): // File: 2.30.c // Author: iBug [...] read more
c
gcc
undefined-behavior
integer-overflow
arm64
3votes
1answer

Recreating JS bitwise integer handling in Python3

I need to translate a hash function from JavaScript to Python. The function is as follows: function getIndex(string) { var length = 27; string = string.toLowerCase(); var hash = 0; for (var i = 0; i < string.length; i++) { hash = string.charCodeAt(i) + (hash << 6) + (hash << [...] read more
python-3.x
hash
integer
binary-operators
3votes
0answers

How >, >=, <, <= are implemented using only bitwise operations

I have seen this and this, from which at least the > is obtained as: int isGt(int a, int b) { int diff = a ^ b; diff |= diff >> 1; diff |= diff >> 2; diff |= diff >> 4; diff |= diff >> 8; diff |= diff [...] read more
bit-manipulation
comparison-operators
3votes
1answer

What is special in gcc about a loop that iterates 999 times?

BACKGROUND Using gcc 7.2 I found that the compiler output changes when a loop iterates 999 times. In particular this program (link to compiler explorer using gcc 7.2): int f() { int i=0x7fffffff-998; while (i+1>i) i++; return i; } compiles (using -O3 -fwrapv) to: f(): mov eax, 2147483647 ret but, [...] read more
c
gcc
3votes
2answers

Bitwise and (&) operator

I read that doing a & 0x7fffffff masks just the sign bit and doesn't tampers with the other bits. int a = Integer.MIN_VALUE; System.out.println(a & 0x7fffffff); But, this code outputs 0 instead of 2147483648 Why is that? read more
java
bit
operations
2votes
1answer

Linux hexdump offset strangeness

I'm trying to hexdump some bytes near the end of a 1 TB hard disk drive. First, let's look near the beginning, 0x1000: % hexdump -n 16 -s 0x1000 -C /dev/sda2 00001000 08 70 b5 7c 20 4c 56 4d 32 20 78 5b 35 41 25 72 |.p.| LVM2 [...] read more
linux
2votes
3answers

qemu-img: Could not open $FILE

I received a single-file VMDK from a vendor that has a virtual appliance for a particular product I'm interested in evaluating. We run a KVM solution (Proxmox) so I tried converting the file but on that system qemu-img blows up. (I was able to convert (multipart) VMDK files from bitnami [...] read more
kvm-virtualization
vmware-vsphere
qemu
vmware-vmdk
2votes
4answers

Ubuntu 11.04 Server Crashing - failed command: READ FPDMA QUEUED

I have a new Ubuntu Server (11.04) that keeps crashing, especially during heavy disk I/O (like making a backup). It's drives are configures as a RAID 10 with 4 1TB Western Digital Caviar Black Hard Drives. The message I'm seeing via /proc/kmsg when it crashes is, "failed command: READ FPDMA [...] read more
ubuntu
server-crashes
ubuntu-11.04
2votes
2answers

What is the error in code? This seems to run fine in my IDE but doesn't work on online terminal

I'm trying to solve the leetcode question 8String to integer(atoi). But I'm getting a Runtime Error. TypeError: 'str' object is not callable Line 9 in myAtoi (Solution.py) I understand it's due to a string object getting called but can't seem to figure out what to fix. class Solution: def myAtoi(self, [...] read more
python
python-3.x
string
typeerror
2votes
2answers

Separate object fields into two files by serializing DataContract

I an using DataContractSerializer and i want to separate data of same object into multiple files. [DataContract] public class TestObj { [DataMember] protected double field1 = 0.0; [DataMember] protected double field2 = 0.0; } Specifically I want to save field1 in one XML file and field2 in a different XML [...] read more
c#
serialization
datacontractserializer
datacontract
2votes
1answer

I'm using std::bitset and trying to create two arrays std::bitset with size 100,000,000,000

I am using std::bitset and I try to create two arrays std::bitset with size 100,000,000,000. As a result, program fills only 298 MB of my RAM but must to fill ~24 GB. I have 32 GB RAM and now 26 GB are free. When I build my code for x86, [...] read more
c++
windows
std-bitset
2votes
2answers

2D perlin noise in C

I followed this tutorial. When I implement it in my code (Raytracing), and apply it on a sphere, I get a uni-color sphere, with one stripe of darker pixel on it. When I change the random float generator, I got the basic linear noise, which isn't my goal. Can you [...] read more
c
algorithm
2votes
1answer

printf and gcc -O option change return value

i'm trying to understand how gcc -O option and printf can change return value. in the code below isTmax is my function that return 1 if the input is the largest int value. int isTmax(int x); int main(void) { printf("%d\n", isTmax(0x7fffffff)); } int isTmax(int x) { int temp = x [...] read more
c
gcc
return-value
2votes
2answers

My perlin noise looks like wrong, almost like grey t-shirt material (heather). Why?

I tried a quick and dirty translation of the code here. However, my version outputs noise comparable to grey t-shirt material, or heather if it please you: #include <fstream> #include "perlin.h" double Perlin::cos_Interp(double a, double b, double x) { ft = x * 3.1415927; f = (1 - cos(ft)) * [...] read more
c++
random
perlin-noise
ppm
noise-generator
2votes
1answer

Perlin Noise 2D: turning static into clouds

I am trying to wrap my head around Perlin noise. This article has helped and I have been trying to recreate the cloud type images that it provides. My noise code is as follows: #include "terrain_generator.hpp" using namespace std; #define PI 3.1415927; float noise(int x, int y) { int n [...] read more
c++
opengl
perlin-noise
2votes
1answer

gcc takes much memory to compile c++ file with very large object on stack

I have a c++ file which uses a std::bitset<size>. When compiling using gcc on windows subsystem linux, if size = 1000000000 (1Gbit) cause about 1.6GB compile-time memory using, size = 10000000000 (10Gbit) cause about ~6GB memory and ~15GB virtual memory (my PC has 8GB memory in total). The memory is [...] read more
c++
gcc
memory
stack-overflow
2votes
1answer

How to fix "Dispatcher has no subscribers" error for a simple message producer?

I'm trying to create a simple JMS producer using Spring Integration. Can any one help me to explain why I'm getting "Dispatcher has no subscribers" error? I'm using ActiveMQ locally and based on my ActiveMQ log, both queue and session are created when I run my test application. But there [...] read more
java
spring-integration
spring-jms
2votes
1answer

Scikit - SGDRegressor doesn't fit

Hello I am trying to fit a small set of data using scilearn. import numpy as np from sklearn import linear_model, model_selection X = np.array([[86.5999984741211, 9.10000038146973, 14.3000001907349,1], [66.9000015258789, 17.3999996185303, 11.5,1], [66.3000030517578, 20 , 10.6999998092651,1], [78.6999969482422, 15.3999996185303, 12.1000003814697,1], [76.1999969482422, 18.2000007629395, 12.5,1], [84.4000015258789, 9.89999961853027, 12.1000003814697,1], [79.1999969482422, 8.5 , 10.1000003814697,1], [77.5 , 10.1999998092651, [...] read more
python
machine-learning
scikit-learn
linear-regression
2votes
3answers

i dont understand what is 0x7fffffff mean. is there any other way to code getHashValue method?

public int getHashValue(K key){ return (key.hashCode() & 0x7fffffff) % size; } i dont understand what is 0x7fffffff mean. is there any other way to code getHasValue method? read more
java
2votes
2answers

Java Hex Number and Conditionals

I am new to Java so I have a problem with hex numbers usage in conditionals and its sizes. There is some issue about Scanner class too. I have searched java documents for primitive data types. The program is about; take a number and look in which data type it [...] read more
java
types
java.util.scanner
1vote
0answers

Is my SSD failing?

I've started getting these messages intermittently (see below). I got a whole lot of them several days ago, then they stopped. They occurred again last night, and stopped after the last line below. My /dev/sda is a Samsung 850 EVO Series 120GB SSD and is under warranty. It still seems [...] read more
linux
hard-drive
1vote
1answer

Linux root filesystem on custom hardware

I have a custom-designed SoC implemented on FPGA, based on an ARM-processor clone, on which I am trying to boot Linux (kernel 3.10). I have successfully added support to my custom peripherals (an USART, Interrupt Controller and Timer), allowing me to see the printk messages displayed by the kernel up [...] read more
boot
memory
filesystems
linux-kernel
1vote
1answer

Can't connect to AWS instance after import with stock Centos7

I am trying to import a Centos7 based VM into Amazon AWS. The VM was created with the Centos7 minimal ISO installed into VirtualBox. Networking in the VM works fine locally before trying to do the import. I am using the EC2 command line tools to do the import: ec2-import-instance [...] read more
amazon-ec2
amazon-web-services
centos7
import
1vote
0answers

CentOS Raid 1 drive fails on raid-check

I have a pair of HP DL320e servers configured identically with two WD Red 6TB drives in a software raid 1 array. The DL320e has an on board raid controller which is disabled in favour of linux software raid. Both machines seem to work fine and the raid arrays look [...] read more
raid1
centos7
1vote
0answers

Counting 1's and 0's in a bit sequence

These two methods are from Hacker's Delight. I wish to count the number of 0's and 1's in a bit sequence. For example, for the following sequence 00000000000000000011011100111101 , I thought after removing the leading zeros I would get: * 2 Ones * 1 Zero * 3 Ones * 2 [...] read more
java
bit
1vote
0answers

What is source of IID 0x7ffffff error in CCES debugger, and how to fix it properly?

I have problems with MDMA transfer on ADSP-SC584. I work in CCES IDE 2.8.3 I take MDMA CrossCore example project ,and do changes towards ARM direction of data flow. So initialisation is the same(MCAPI addresses and SID of interrupt). I have complex problem with it: 1. When i run project [...] read more
c
udp
micrium
1vote
1answer

Bitshift Causing Overflow When It Shouldn't

When I am bitshifting the max positive 2's complement, shouldn't shifting it 31 bits make an effective 0 because it starts as 0111 1111, etc. I have tried decreasing the shift but I am assuming it's just the computer reading it incorrectly. int main(void) { int x = 0x7FFFFFFF; int [...] read more
c
linux
bit-shift
1vote
2answers

Perlin noise value range

I used perlin noise to generate a 2D height map. At first i tried some parameters manually and found a good combination of amplitude, persistence,... for my job. Now that i'm developing the program, i added the feature for user to change the map parameters and make a new map [...] read more
java
perlin-noise
1vote
1answer

Can I do binary taint analysis?

I want to analyze the following binary. 4005e0: 55 push %rbp 4005e1: 48 89 e5 mov %rsp,%rbp 4005e4: 48 83 ec 10 sub $0x10,%rsp 4005e8: c7 45 fc 09 00 00 00 movl $0x9,-0x4(%rbp) 4005ef: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp) 4005f6: c7 45 f4 00 00 [...] read more
security
assembly
binary
analytics
dynamic-analysis
1vote
1answer

How to check value of variable is between MAX_INT and MIN_INT of 32 bit OS

I understand that all variables are of type strings. How can we check a variable value between MAX_INT(0x7FFFFFFF) and MIN_INT (-0x80000000) of 32 bit OS set var "12334" ...How to check var variable datatype and value range .. read more
tcl
1vote
2answers

How to use base32 in combination with hotp (one time passwords) in python?

for a university exercise I want to develop a simple hotp server-client system in python. In this case the client sends a password and a one time password to the server. The server knows the secret, calculates the current hotp and compares the values it receives. So far, so good. [...] read more
python
python-3.x
hmac
one-time-password
base32
1vote
0answers

How to upload large files through filestack?

When I try to upload a large file (+5GB) with the client.upload function of filestack-js in nodejs it throws an error: RangeError: File size is greater than possible Buffer: 0x7fffffff bytes I was using this SDK because I read that this allows to upload a large files through chunks but [...] read more
javascript
node.js
file
request
filestack
1vote
1answer

Implementing noise function in python from C code

I want to play around with procedural content generation algorithms, and decided to start with noises (Perlin, value, etc) For that, I want have a generic n-dimensional noise function. For that I wrote a function that returns a noise generation function of the given dimension: small_primes = [1, 83, 97, [...] read more
python
procedural-generation
1vote
1answer

SQL: Random sampling X% of samples(unique IDs) from duplicated ID table

I am using SQL and obtained the following table: userID| time | location A10 | 20130801| 1000 A10 | 20130802| 1002 A10 | 20130806| 1008 B21 | 20130803| 1000 B21 | 20130801| 1099 C11 | 20130802| 1000 D33 | 20130802| 1002 D33 | 20130806| 1877 E01 | 20130801| 1765 E01 [...] read more
sql
sql-server
1vote
4answers

SQL Query for Random 10% with a minimum of 20 rows

I have been tasked with generating a report that will randomly pick 10% of a unique ID, unless 10% is less than 20 items in which case the report would pick 20 random ID's. I have been using NewID to generate the 10%, but that really isn't the best as [...] read more
sql
sql-server
reporting-services
sql-server-2008-r2
ssrs-2008
1vote
2answers

Windows Virtual Address Space

as I read here the virtual address space of a 32 bit Windows application has 2GB of storage (from 0x00000000-0x7FFFFFFF). The other 2GB are reserved for the system address space. But now I found a pointer in a 32bit program (using Cheat Engine) which is pointing to an address which [...] read more
windows
pointers
system
cheat-engine
1vote
2answers

Why does this implementation of Quadratic Probing fail when not overriding values on collision?

My current implementation of Quadratic Probing overrides the item being stored at the current index with the new item when a collision occurs. I insert three Person objects which are stored by using their lastname as key. To test the collision resolution of the implementation they all have the same [...] read more
java
hash
quadratic-probing
1vote
6answers

How to find TMax without using shifts

Using ONLY ! ~ & ^ | + How can I find out if a 32 bit number is TMax? TMax is the maximum, two's complement number. My thoughts so far have been: int isTMax(int x) { int y = 0; x = ~x; y = x + x; return [...] read more
c++
c
binary
logic
bit-manipulation
1vote
0answers

Why is .NET Dictionary FindEntry faster than simple loop?

I try to understand how .net C# Dictionary works. I always heard its search mechanism is fast. While looking at the implementation i saw the following code. The following is the FindEntry function as show in:MSDN implementation private int FindEntry(TKey key) { if( key == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key); } if [...] read more
c#
.net
performance
msdn
1vote
2answers

Why ConcurrentHashMap calculate hashcode with 0x7fffffff in 1.8?

When to calculate key's hashcode, spread() method is called: static final int spread(int h) { return (h ^ (h >>> 16)) & HASH_BITS; } where HASH_BITS equals 0x7fffffff, so, what is the purpose of HASH_BITS? Some one says it make the sign bit to 0, I am not sure about [...] read more
java
hashcode
concurrenthashmap
1vote
1answer

Spring integration testing flow with exception

I'm trying to test the flow, specifically when an exception is thrown, but for some reason I'm not getting anything in the errorsFromSend channel. Here is the gateway: @MessagingGateway public interface Send { @Gateway(requestChannel = "sending", headers = @GatewayHeader(name = "errorChannel", expression = "@errorsFromSend")) void send(final String s); } the [...] read more
unit-testing
error-handling
spring-integration
1vote
0answers

How to get RSCP, SINR and EcNo values in Android

I need to find RSCP, SINR and EcNo. So far i am able to calculate RSRP and RSRQ values from android.telephony.SignalStrength. My questions are: 1. When I try to get SignalStrength#getTdScdmaDbm() via reflection it returns Integer.MAX_VALUE (if i debug at line 300 its value is 0) According to AOSP RIL [...] read more
android
gsm
telecommunication
lte
cdma
1vote
1answer

Is this a static method, or something else?

I'm learning Dart so that I can do some flutter mobile development. Dart's pretty straightforward to learn and I like it, though there are a few differences from Java / C# that I have to work through. One of them has to do with this code: class CatalogSlice { final [...] read more
dart
1vote
1answer

Implicit Casting Issues (Integer literals)

I'm developing custom Int/UInt classes for larger integers. They work great with assignment/casting/arithmetic, etc. However, it exposed an issue that occurs with xunit and MSTest. Here's my code: UInt240 x = 0x7fffffff; Assert.Equal(0x7fffffff, x); The issue is that if I supply an unsigned type on the right side, and provide [...] read more
c#
casting
mstest
implicit
xunit
1vote
1answer

What is going on with this int to float conversion, why is it innacurate?

So I've basically got this code #include <stdio.h> int main() { int n = 0x7fffffff; float f = n; printf("%d\n", n); printf("%f\n", f); n = 0x00ffffff; f = n; printf("%d\n", n); printf("%f", f); } This gives this output: > 2147483647 > 2147483648.000000 > 16777215 > 16777215.000000 Why the difference between [...] read more
c
0votes
0answers

Reading SMART results for failing disk

I recently started having trouble with my Dell laptop and would appreciate any recommendations on the next steps for my issue. I have portions of the dmesg log below to show the errors I'm getting. My laptop has 6 GB RAM and 1 TB convential hard drive (no SSD) running [...] read more
linux
hard-drive
rsync
smart
0votes
0answers

Input/Output error while playing video

I am using Linux Mint 15. Nowadays I am getting Input/Output error while watching movies. Sometimes when I copy/paste, I get the same error. What should I do? I have a laptop so unable to check inside the machine. If the hard disk is corrupt, how to take the backup [...] read more
linux
hard-drive
video
linux-mint
hardware-failure
0votes
1answer

need help SolusVM Xen-pv error

I recently use Solusvm and xen and I have a problem with xen-pv there is a xen-pv template by default with the solusvm Centos-5.3-x86 I have created a machine to test it but I have this error : xm create -c vm103.cfg Using config file "./vm103.cfg". Started domain vm103 (id=45) [...] read more
linux
xen
0votes
1answer

SCSI error: return code = 0x08000002, sense key: Aborted Command

The kernel logs: ata2.00: exception Emask 0x0 SAct 0x7fffffff SErr 0x0 action 0x0 ata2.00: irq_stat 0x40000008 ata2.00: cmd 61/08:f0:6f:5b:97/00:00:00:00:00/40 tag 30 ncq 4096 out res 41/10:01:6f:5b:97/d5:00:00:00:00/40 Emask 0x481 (invalid argument) <F> ata2.00: status: { DRDY ERR } ata2.00: error: { IDNF } ata2.00: configured for UDMA/133 sd 1:0:0:0: SCSI error: [...] read more
software-raid
raid1
scsi
smart
dmraid
0votes
0answers

How to keyboard interrupt user32.GetMessageW / user32.SetWinEventHook loop in python?

I can't seem to figure out how to let Ctrl-C interrupt this code. It prints a KeyboardInterrupt exception to the console when you press Ctrl-C but never actually stops the program. How can I make it actually stop? import ctypes import ctypes.wintypes from random import random user32 = ctypes.windll.user32 ole32 [...] read more
python
windows
ctypes
pywin32
0votes
1answer

Should i store data that need to be cast into variable first? or call Dictionary indexer more than once?

I don't really know how to phrase this well but I confused about performance I have variables that read from the dictionary. but sometimes it can contain null. For example, I have the following: Dictionary<string,object> DataRow = new Dictionary<string,object>(); The previous line is reading Row from database Table and fetch [...] read more
c#
.net
dictionary
memory-management
collections
0votes
0answers

How to get rid of automatically added library provided by GCC?

I'm compiling main.c file by gcc with enabled sanitizer option. As a result, linker command contains "-lubsan" option in its arguments list. Need to say, that I haven't provided "-lubsan" option to gcc explicitly. Moreover, I'm against of using it. So, the question is: "How to get rid of such [...] read more
gcc
linker
ubsan
0votes
1answer

structure occurring C2148 when compiling

I have a very large structure, and it seems to be over the limit, what would be the best way to work this out? Error Message: total size of array must not exceed 0x7fffffff bytes structure occurring C2148 when compiling struct listen_instance { struct instance_l instance[2000]; }; I need all [...] read more
c
data-structures
0votes
1answer

Linker error: Multiple definition of a function

I got stuck with this linker error: movecursor.cpp:(.text+0x0): multiple definition of 'random()' beep.cpp:(.text+0x0): first defined here [Error] ld returned 1 exit status What's going on? main.cpp: #include "beep.h" #include "movecursor.h" beep.h: #include <Windows.h> #include <mmsystem.h> DWORD WINAPI BeepSec(LPVOID parameters); beep.cpp: #include "beep.h" #include "random.h" DWORD WINAPI BeepSec(LPVOID parameters) { code... [...] read more
c++
winapi
linker
0votes
0answers

Getting memory location of C++ static variable in Visual Studio Community Debugger

In this simple C++ program: int main() { int n = 0xffffff12; static int q = 0x7fffffff; static int r = 0x10000000; static int R = 0x80000000; return 0; } I can retrieve the actual memory location of variable n in Visual Studio Community debugger by looking at the assembly [...] read more
c++
visual-studio
debugging
memory
static
0votes
1answer

Manual vectorization/SSE for a complex problem in C++

I want to speed up my algorithm which is an objective function f(x). The problem dimension is 5000. I have already introduced a lot of improvement in the code, but still the calculation time does not fit to my expectation. Most of the dataset are allocated dynamically as (float*)_mm_malloc(N_h*sizeof(float),16). In [...] read more
c++
gcc
optimization
x86
sse
0votes
1answer

Install GYM openAI win 10/7

I am new here and following this guide ( https://towardsdatascience.com/how-to-install-openai-gym-in-a-windows-environment-338969e24d30 ) it is not possible to install the open AI, there is always an error when compiling. Tried different versions of anaconda ... python version ... adding compiler to path... Any help would be appreciated! Collecting git+https://github.com/Kojoley/atari-py.gitCloning https://github.com/Kojoley/atari-py.git to c:\users...\appdata\local\temp\pip-req-build-ppc4tb1g [...] read more
windows
install
openai-gym
0votes
0answers

TelephoneManager.getAllCellInfo() on Android Emulator not emulated correctly

I am trying to access the CellInfo using TelephoneManager.getAllCellInfo() on an Android Emulator in Android Studio 3.5. Unfortunately it returns always the same values ... CellInfoGsm:{mRegistered=YES mTimeStamp=1111449158860ns mCellConnectionStatus=2147483647 CellIdentityGsm:{ mLac=3 mCid=91 mArfcn=0 mBsic=0x7fffffff mMcc=310 mMnc=260 mAlphaLong= mAlphaShort=} CellSignalStrengthGsm: rssi=-93 ber=0 mTa=2147483647 mLevel=3} ... independent of what network type and signal [...] read more
android
signal-strength
0votes
1answer

rand and rands implementation in python

I need an implementation of rand and rands from c++ in python to re-encrypt a bunch of files. But can't seem to get it right. I have a exe that un-encrypts a file into text, I also have to source code, after editing the file I need to encrypt it [...] read more
python
c++
python-3.x
random
0votes
1answer

How to not calculate the hashcode each time value is inserted

I have implemented my own hashmap for study purposes. The key has a string and the value has an object of the class I created. By the way, I want to know if my hashcode method is appropriate, and how to not calculate the hashcode every time a value is [...] read more
java
algorithm
hashmap
0votes
2answers

How could I optimise this for loop to run fast on PHP. Runs extremely fast on javascript

So I've been porting some code from Javascript to PHP which works now, however, the execution time is very poor. It takes about 26 seconds in PHP whereas in javascript it is extremely fast. I've been able to break it down to the for loop causing the issue. This is [...] read more
javascript
php
loops
for-loop
0votes
1answer

type in vhdl corresponds to c-language: "uint32_t" or "unsigned long"

What's the closet data type in VHDL to the classic c-language data type "uint32_t", example: #include "stdint.h" void main() { uint32_t data = 0xFFFFFFFF; } From my understanding, VHDL's "positive" and "natural" types are just subsets of a signed "integer" type and are missing half of the range of c-langauge [...] read more
vhdl
0votes
1answer

Divide by zero error from Colt OpenLongObjectHashMap

I saw this exception from Colt OpenLongObjectHashMap: java.lang.ArithmeticException: divide by zero at cern.colt.map.OpenLongObjectHashMap.indexOfKey(Unknown Source) at cern.colt.map.OpenLongObjectHashMap.get(Unknown Source) It's not reproduceable. This is indexOfKey: protected int indexOfKey(long key) { final long tab[] = table; final byte stat[] = state; final int length = tab.length; final int hash = HashFunctions.hash(key) & 0x7FFFFFFF; [...] read more
java
hashmap
divide-by-zero
compiler-bug
colt
0votes
1answer

Work on an array of signed int as if it contained unsigned values

I've inherited some old code that assumes that an int can store values from -231 to 2^31-1, that overflow just wraps around, and that the sign bit is the high-order bit. In other words, that code should have used uint32_t, except that it wasn't. I would like to fix this [...] read more
c
arrays
casting
signed
0votes
1answer

Limit to size of array type, while there's not yet an instance

I have the following minimal test program: struct Test { double contents [1000000000]; }; int main () { return 0; } It refuses to compile, even though the compiler cannot know wether I will instantiate Test statically, on the stack or on the heap. Why does the compiler complain? Are [...] read more
c++
arrays
windows
visual-c++
size
0votes
1answer

How to declare a vector of data

I'm doing an Assembly program in ArmV8 that uses multiple constants (in floating point) that are therefore multiplied by the a certain value (also in floating point). For that, I want to develop a loop that just went trought a vector that contained the constants, incrementing the address each time [...] read more
assembly
arm
arm64
armv8
0votes
1answer

How can I realize a Mars program while Extended (pseudo) instruction or format not permitted is deactivated using the Operation NOT, ADDI and ADDIU?

We have to extend our code. With these operations. Operations [https://i.stack.imgur.com/sWzCa.png] Ziel= destination register in line 14 im getting the error: line 14 column 2: Extended (pseudo) instruction or format not permitted. See Settings. When i comment line 14. (#not $9, $9) i get this errorline 27: Runtime exception at [...] read more
assembly
mips
mars
0votes
1answer

initializing values in Mars 4.5 getting an error

My homework is to initialize values in certain registers. We have to turn off Permit extended (pseudo) instructions and formats. When i try to assemble the code i get this error message for line 7,8,9 Extended (pseudo) instruction or format not permitted. Also is there a way to optimize the [...] read more
assembly
mips
mars-simulator
0votes
0answers

what does this 0x7fffffff mean in this function and where can i learn more about it

want to understand this and learn to implement it myself what does 0x7FFFFFF mean where can i look to learn more var secureRandom = function(count) { var rand = new Uint32Array(1) var skip = 0x7fffffff - 0x7fffffff % count var result if (((count - 1) & count) === 0) { [...] read more
javascript
0votes
4answers

Javascript - will this noise function work?

I have the following deterministic noise function which I've been using in a C# and C++ terrain generator for a while: float GridNoise(int x, int z, int seed) { int n = (1619*x + 31337*z + 1013*seed) & 0x7fffffff; n = (n >> 13) ^ n; return 1 - ((n*(n*n*60493 [...] read more
javascript
random
noise
0votes
1answer

I don't know why ArrayIndexOutOfBoundsException occur in Separate Chaining

I have a problem implementing Separate Chaining Hash. I made hash function as follows and expected to made hash value that is smaller than M. private int hash(K key) { return (key.hashCode() & 0x7fffffff) & M; } I don't know why I'm getting ArrayIndexOutOfException. When I tried to debug, I [...] read more
java
0votes
1answer

Interval schedule question about choose the same length of time from each interval

I was struggle with an interval schedule question, the question description as follow: > Description: Lanran has N friends. Every Sunday, Lanran has to play with his friends. The i-th friend can play with Lanran from time a to time b (a and b are included). However, Lanran has to [...] read more
c++
algorithm
intervals
schedule
greedy
0votes
1answer

How to make the android.widget.Scroller stop scrolling at a specific item index?

I'm experimenting with this project: https://github.com/maarek/android-wheel/blob/master/wheel-demo/src/kankan/wheel/demo/extended/PasswActivity.java I've been trying to implement the following: 1) set the wheel to land on the number 5 (or any other number) 2) scroll the wheel for about 2 seconds 3) after spinning stops (could be any number of rotations through 0 to 9) the [...] read more
android
0votes
1answer

Compute Shader not compiling for specific (valid) code

I'm experiencing weird behavior with conditional loops, branches and updating the UAV with my compute shader (DX11), CS 5.0. I'm t esting a naive raymarching through Sparse Voxel Octtree bricks. The data is linearised by BFS. The structure (LWSVO = Light Weight SVO) looks like: struct LWSVO { int firstChild; [...] read more
directx
shader
hlsl
0votes
0answers

VirtualAlloc2 with MemExtendedParameterAddressRequirements always produces ERROR_INVALID_PARAMETER

I am trying to use VirtualAlloc2 with MemExtendedParameterAddressRequirements to allocate memory to specific regions of address space. This is my first time using this new API but I haven't been able to ever get it to succeed. It always returns nullptr and GetLastError is ERROR_INVALID_PARAMETER. Here is a minimal example, [...] read more
winapi
0votes
1answer

How can I add my treat node in multiple places throughout the game?

I want to have about 15 treats and I just want to change the x position of these treats. I don't want to copy and paste this code 15 times, so how can I go about doing this? func createTreatNode() { let atlas = SKTextureAtlas(named: "Treat") let q1 = atlas.textureNamed("treat1.png") [...] read more
swift
xcode
sprite-kit
skspritenode
0votes
1answer

Using AND instruction with 32-bit operand in 64-bit

I have a question on the AND instruction in 64-bit mode. I have this manual telling me that the AND 32-bit immediate is to be sign-extended to 64-bit. But I can't do this and rax,0x80000000 Which is ridiculous I think because 0x800000 is a perfect DWORD operand. The highest I [...] read more
assembly
x86
size
x86-64
operands
0votes
3answers

Why do C compilers not warn when assigning integer value too high for signed type?

(assuming 64bit machine) e.g. int n = 0xFFFFFFFF; //max 32bit unsigned number printf("%u\n", n); The maximum positive number that a regular signed integer (32bit) can store is 0x7FFFFFFF. In the above example I'm assigning the maximum unsigned integer value to a regular signed integer, I'm receiving no warnings or error [...] read more
c
integer
unsigned-integer
0votes
1answer

How does the _mm_cmpgt_epi64 intrinsic work

I'm using the _mm_cmpgt_epi64 intrinsic to implement a 128-bit addition, and later a 256-bit one. Looking at the result of this intrinsic something puzzles me. I don't understand why the computed mask is the way it is. const __m128i mask = _mm_cmpgt_epi64(bflip, sumflip); And here's the output in my debugger: [...] read more
x86-64
sse
simd
intrinsics
sse4
0votes
1answer

Why does toHexString have variable length?

Why is it that toHexString prints different strings in what appears to be very specific circumstances? Printing a number below 0x80000000 works just fine. Adding 1 to that value and printing it works fine. But assigning that value directly does not print the same thing, instead I have to add [...] read more
java
type-conversion
hex
0votes
2answers

Stray characters seen at output of snprintf

I have a string creating function in C which accepts an array of structs as it's argument and outputs a string based on a predefined format (like a list of list in python). Here's the function typedef struct { PacketInfo_t PacketInfo; char Gnss60[1900]; //and other stuff... } Track_json_t; typedef struct [...] read more
c
arm
embedded
-1votes
0answers

Need help reverse engineering (understanding) Assembly

Good day, I have created an objdump from an executable. And received a bunch of code. However, I am unsure what this one particular function does. I have a few ideas here and there, but still can't seem to figure it out. To give it some context, a random number [...] read more
assembly
x86
reverse-engineering
disassembly
-1votes
1answer

Bitwise multiplication with correction for overflow

I am trying to use Bitwise operators ( ! ~ & ^ | + << >> ) in C to achieve a multiplication of 4 while also correcting for Positive and Negative overflow by returning the Max value and Minimum value, respectively. For example, Function(0x10000000) = 0x40000000 Function(0x20000000) = 0x7FFFFFFF [...] read more
c
bit-manipulation
-1votes
2answers

invalid use of member ‘xx::x’ in static member function

I want to apply selection operation in a 3d viewer (using qt-creator) any.h file: #include <GL/gl.h> #include <GL/glu.h> #include <stdlib.h> #include <stdio.h> #include <GL/glut.h> class any { public: any(); int board[3][3]; void init(void); static void drawSquares(GLenum mode); static void processHits (GLint hits, GLuint buffer[]); static void pickSquares(int button, int state, [...] read more
c++
qt
compiler-errors
computational-geometry
-1votes
2answers

How to print 8 Byte void pointer (including chars) as hex

I am currently trying to print out data, captured by the SSH Wireshark dissector. I debugged the void pointer array which I need and in the debugger the first index looks as follows: [0] 0xa9ac1405c4040000 void * [1] 0xc4c2f211de8a3e38 void * However when i try to print the stuff the [...] read more
c
pointers
printing
-1votes
2answers

Error 1 error C2148: total size of array must not exceed 0x7fffffff bytes I get this Error in C

I want to make a char[1 048 576][16 384][1024] and a int [1 048 576][16 384] but I get an Error! I want to make an 3d array as big as excel can handle! read more
c
arrays
-1votes
2answers

How to fix mentioned MISRA-2012 10.4 and 10.9 violations issue in this code?

There are required pieces to formulate my problem. Below are content of MyError.h header file. -------------------------------------------------------------------------------- MYERROR.H ########################### # myError.h ########################### 1 typedef enum 2 { 3 MySuccess = 0x00000000, 4 MyError1 = 0x00000001, 5 MyError2 = 0x00000003, 6 MyForce32 = 0x7FFFFFFF 7 } MyError; 8 #define PROPAGATE_ERROR_FAIL_MY_1(_err) \ 9 [...] read more
c
misra
safety-critical
-1votes
1answer

Php function calling

I have this function: public function getCode($secret, $timeSlice = null) { if ($timeSlice === null) { $timeSlice = floor(time() / 30); } $secretkey = $this->_base32Decode($secret); // Pack time into binary string $time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice); // Hash it with users secret key $hm = hash_hmac('SHA1', $time, $secretkey, true); // Use [...] read more
php
-2votes
2answers

How do I figure out which drive is failing?

How do I relate this information with which physical drive is failing? It's a debian kernel. Nov 21 18:06:00 IHPAC kernel: [594026.608042] ata5.00: status: { DRDY } Nov 21 18:06:00 IHPAC kernel: [594026.787427] ata5.00: failed command: WRITE FPDMA QUEUED Nov 21 18:06:00 IHPAC kernel: [594026.966505] ata5.00: cmd 61/00:e8:fb:b6:59/04:00:a2:00:00/40 tag 29 [...] read more
hard-drive
-2votes
4answers

C find maximum two's complement integer

I am tasked with finding maximum two's complement integer, or the TMax. I am at a complete loss for how to do this. I know that the correct value is 0x7fffffff, or 2147483647, but I do not know how exactly to get to this result. That's the maximum number for [...] read more
c
binary
twos-complement
-3votes
1answer

Fast floating point abs function

What is the fastest way to take the absolute value of a standard 32 bit float on x86-64 architectures in C99? The builtin functions fabsf and fabs are not fast enough. My current approach is bit twiddling: unsigned int tmp = *((unsigned int *)&f) & 0x7fffffff; float abs = *((float [...] read more
c
performance
floating-point
c99

Comments

Leave a comment

(plain text only)

Sources

  1. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0