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
Origin
Customer
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.
I was implementing a hashmap in C as part of a project I'm working on and using random inserts to test it. I noticed that rand() on Linux seems to repeat numbers far more often than on Mac. RAND_MAX is 2147483647/0x7FFFFFFF on both platforms. I've reduced it to this test [...] read more
I am trying to use one-time passwords that can be generated using Google Authenticator application. WHAT GOOGLE AUTHENTICATOR DOES Basically, Google Authenticator implements two types of passwords: * HOTP - HMAC-based One-Time Password, which means the password is changed with each call, in compliance to RFC4226, and * TOTP - [...] read more
I'm trying to understand why the following code doesn't issue a warning at the indicated place. //from limits.h #define UINT_MAX 0xffffffff /* maximum unsigned int value */ #define INT_MAX 2147483647 /* maximum (signed) int value */ /* = 0x7fffffff */ int a = INT_MAX; //_int64 a = INT_MAX; // makes [...] read more
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
I have been going crazy trying to read a binary file that was written using a Java program (I am porting a Java library to C# and want to maintain compatibility with the Java version). JAVA LIBRARY The author of the component chose to use a float along with multiplication [...] read more
how does one write a hexadecimal integer literal that is equal to Int.MIN_VALUE (which is -2147483648 in decimal) in Kotlin? AFAIK, an Int is 4 bytes...and sometimes it seems like 2's complement is used to represent integers...but I'm not sure. I've tried the following hex literals to help myself understand [...] read more
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
JavaScript can handle the following Math just fine: var result = (20000000 * 48271) % 0x7FFFFFFF; But in some programming languages, that first int*int multiplication results in a value too large to hold in a standard 32 bit integer. Is there any way to "simulate" this in JavaScript, and see [...] read more
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
Can someone explain to me how I convert a 32-bit floating point value to a 16-bit floating point value? (s = sign e = exponent and m = mantissa) If 32-bit float is 1s7e24m And 16-bit float is 1s5e10m Then is it as simple as doing? int fltInt32; short fltInt16; [...] read more
There is this Javascript function that I'm trying to rewrite in Java: function normalizeHash(encondindRound2) { if (encondindRound2 < 0) { encondindRound2 = (encondindRound2 & 0x7fffffff) + 0x80000000; } return encondindRound2 % 1E6; } My Java adaptation: public long normalizeHash(long encondindRound2) { if (encondindRound2 < 0) { encondindRound2 = (((int) encondindRound2) [...] read more
Under Spring Boot 1.3.0.M5 I'm using spring.data.rest.max-page-size=10 in application.properties. 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 [...] read more
Need some help understanding python solutions of leetcode 371. "Sum of Two Integers". I found https://discuss.leetcode.com/topic/49900/python-solution/2 is the most voted python solution, but I am having problem understand it. * How to understand the usage of "% MASK" and why "MASK = 0x100000000"? * How to understand "~((a % MIN_INT) [...] read more
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
Is the comparison of 32 bits faster than the comparison of 64 bits? I was looking at this file http://www.netlib.org/fdlibm/s_cos.c They have this piece of code /* |x| ~< pi/4 */ ix &= 0x7fffffff; if(ix <= 0x3fe921fb) return __kernel_cos(x,z); I understand the first line, which calculates the absolute value of [...] read more
I am developing a toy OS in assembly and I have a problem when switching from protected mode back to real mode. I have successfully switched to protected mode, called the kernel that writes text to [0xb8000] video memory, returned to the caller and (probably) switched back to real mode. [...] read more
I have a small unit test here which has undefined behaviour. Source code: #include <gtest/gtest.h> TEST(test, test) { int k = 0x7fffffff; k += 1; // cause integer overflow } GTEST_API_ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } I enable UBSAN in my CMakeLists.txt: cmake_minimum_required (VERSION [...] read more
I am debugging a production code written in C and its simplest form can be shown as - void test_fun(int sr) { int hr = 0; #define ME 65535 #define SE 256 sr = sr/SE; <-- This should yield 0 if(sr == 1) hr = ME; else hr = (ME+1)/sr; [...] read more
bug.c #include <stdio.h> int main() { int x = 0x7fffffff; printf("%x\n", x); printf("%x\n", ~x); printf("%x\n", ~x + ~x); printf("%x\n", !(~x + ~x)); } I compile using gcc -m32 bug.c -o bug This outputs: 7fffffff 80000000 0 0 It should output 7fffffff 80000000 0 1 I am using gcc 9.3 and [...] read more
This is a Park-Miller pseudo-random number generator: def gen1(a=783): while True: a = (a * 48271) % 0x7fffffff yield a The 783 is just an arbitrary seed. The 48271 is the coefficient recommended by Park and Miller in the original paper (PDF: Park, Stephen K.; Miller, Keith W. (1988). "Random [...] read more
I am trying to create a custom linear congruential generator (LCQ) in JavaScript (the one used in glibc). Its properties as it's stated on Wikipedia are: m=2^31 , a=1103515245 , c=12345. Now I am getting next seed value with x = (1103515245 * x + 12345) % 0x80000000 ; // [...] read more
I'm building a watchOS app that needs to periodically request information from a companion iPhone app to refresh a complication. To achieve this, I have a WKApplicationRefreshBackgroundTask that runs periodically. It uses sendMessage(_:replyHandler:errorHandler:) from WatchConnectivity to request the information from the iPhone app, process the reply, and update the complication. [...] read more
I've got a toy x86 assembly program that I'm writing and compiling with as and ld: .text .global _start _start: movq $1, %rax movq $0x7FFFFFFF, %rbx L1: cmp %rbx, %rax je L2 addq $1, %rax jmp L1 L2: movq %rax, %rbx movq $1, %rax int $0x80 And then to build: [...] read more
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
int c = 0xffffffff; printf("%x\n", (c) == (0xffffffff)); printf("%x\n", (c >> 1) == (0xffffffff >> 1)); The first output is 1 but the second output is 0. And c >> 1 outputs 0xffffffff. But why? read more
Our internal program is written in C makes extensive use of snprintf() for many piece, and I noticed that during debugging with perf record/report, it's spending a lot of time on the following: │ _IO_vfprintf_internal(): ▒ │ mov -0x510(%rbp),%rdx ▒ │ mov %r12,%rsi ▒ │ mov %r15,%rdi ▒ │ → [...] read more
#include <stdio.h> void show_case(int x) { printf("x + x + 2 = %d\n", x + x + 2); printf("!(x + x + 2) = %d\n", !(x + x + 2)); } int main(){ show_case(-1); // the output is 0 & 1 show_case(0x7fffffff); // the output is 0 & 0; return [...] read more
I've been digging in hash table source code. And found how hashing occurs: int index = (hash & 0x7FFFFFFF) % tab.length; I don't understand why bitwise AND used here? if we turn 0x7FFFFFFF into binary we get = 111 1111 1111 1111 1111 1111 1111 1111 As I know bitwise [...] read more
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
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
I get ArithmeticException: / by zero when I run my code, how I can correct it. Why I get this error despite of I have 5 array size, when I run debugging I get the error at hash(Key key). How I can correct the error message please. any one can [...] read more
Thank you so much for answering this question. I use lame and I want to decode mp3 file to wav. I succeeded in decoding mp3 files into wav files through several searches. However, the size of the wav file is created too large and an error message appears. Media player [...] read more
I would like to suppress one error in a third-party library, but still have the program exit 1 on any other failed check. It seems to me that -fno-sanitize-recover will exit the program regardless of the suppressions file's contents. With -fsanitize-recover on the other hand, the specified error is correctly [...] read more
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. However, I found a pointer in a 32bit program (using Cheat Engine) which is pointing to an address which isn't [...] read more
I was going through Integer class code and noticed MIN_VALUE and MAX_VALUE are annotated with @native. My question is 1. What is the purpose of using @native annotation? 2. Where can we find native code which is used by @native? 3. Is there any use case where we should use [...] read more
https://opensource.apple.com/source/xnu/xnu-201/osfmk/kern/printf.c.auto.html Hello! While analyzing Apple's printf code, I have a question! case 's': { register char *p; register char *p2; if (prec == -1) prec = 0x7fffffff; /* MAXINT */ p = va_arg(*argp, char *); if (p == (char *)0) p = ""; if (length > 0 && !ladjust) { [...] read more
I'm currently working on a safe integer library for C++. I've come across some issues when implementing subtraction. Here's what I start with: #include <limits> #include <stdexcept> template<typename I> class safe_int { I val; public: typedef I value_type; static constexpr I max = std::numeric_limits<I>::max(); static constexpr I min = std::numeric_limits<I>::min(); [...] read more
I'm learning about binary representation of integers and tried to write a function that returns an int multiplied by 2 using saturation. The thought process is if the value overflows positively the function returns INT_MAX, and conversely if it overflows negatively it returns INT_MIN. In all other cases the binary [...] read more
I am using the stb libraries to load textures on the fly for OpenGL. I'm trying to use the function from stb_image_write.h. I cannot find any documentation on how to properly use the function stbi_write_png_to_mem my code looks like the following #ifndef STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION #include <stb/stb_image_write.h> int main( ) [...] read more
C99 defines int_fast16_t as an "integer types being usually fastest having at least the specified width", and Microsoft define it as a 32-bit integer in MSVC 2010: typedef char int_fast8_t; typedef int int_fast16_t; typedef int int_fast32_t; typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; Yet, Microsoft [...] read more
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
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
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
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
I am reviewing a function to generate keys for a Radix Map and found the implementation of rand() to be novel to me. Here is the function: static int make_random(RadixMap *map) { size_t i = 0; for (i = 0; i < map->max - 1; i++){ uint32_t key = (uint32_t) [...] read more
I installed gem5 on my ubuntu 18.04.5. If I run a generic fs.py ARM architecture then the simulation boots up fine no matter what configuration I use. For example: ./build/ARM/gem5.opt configs/example/fs.py --kernel=/home/ting-bazinga/gem5/fs_imgs/binaries/vmlinux.arm64 --disk-image=/home/ting-bazinga/gem5/fs_imgs/disks/aarch32-ubuntu-natty-headless.img I followed multiple tutorials to run gem5 in full system mode in ARM bigLITTLE architecture but none [...] read more
According to my understanding time_t rawtime = 0xffFFffFF is GMT: Sunday, February 7, 2106 6:28:15 AM But programm below brings Thu 1970-01-01 02:59:59 MSK in some compilers and just crashes in others. int main() { time_t rawtime = 0xffFFffFF; struct tm ts; char buf[80]; ts = *localtime(&rawtime); strftime(buf, sizeof(buf), "%a [...] read more
Newlib is a C standard library implementation (largely inspired by BSD libc) intended for use on embedded systems. Apparently, the string to floating point conversion functions (strtod, strtof) use dynamic memory allocation by calling a function called Balloc, which calls _calloc_r which calls _malloc_r. Why? I tried to look at [...] read more
Tcp communication is very slow by 127.0.0.1 or eth IP(eg:10.10.253.12) on the same host. server listen on 0.0.0.0:2000, client connect to 127.0.0.1:2000 or local eth ip:10.10.253.12:2000, CS transfer speed only 100KB per second. Program written by C using libevent and Java using Netty have the same effect, program written as: [...] read more
I have this little script to encode and decode a header HEADER_LENGTH = 4 class Header: def encode(length: int, isRequest: bool): if length > 0x7fffffff: raise ValueError("length too big to handle") byteList = [(isRequest << 7) + ((length >> 24) & 0x7f), (length >> 16) & 0xff ,(length >> 8) [...] read more
I am writing a kernel and I need to self relocate above 0x7FFFFFFF. To do that, I need to refer, using absolute addressing, to the beginning and end of my kernel and to a symbol, where execution continues after the relocation. I have been unable to figure out any way [...] read more
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
I've found different values for h NULLs between k.h and q: q)0x00 vs 0W 0x7fffffffffffffff q)0x00 vs 0N 0x8000000000000000 q)0x00 vs 0Ni 0x80000000 q)0x00 vs 0Wi 0x7fffffff q)0x00 vs 0Wh 0x7fff q)0x00 vs 0Nh 0x8000 In q it all looks familiar, but in k.h nh seems quite strange: // nulls(n?) [...] read more
I need to have an int variable go up to 4294967295 (0xFFFFFFFF), without using unsigned and long, so it can actually be used by other functions. Is that even possible? read more
# 0x00007f33caf5a85f: cmp rax, 0xffffffff80000000 # 0x00007f33caf5a865: jnl 0x7f33caf5a898 ... target_of_jnl: # 0x00007f33caf5a898: cmp rax, 0x7fffffff # 0x00007f33caf5a89e: jle 0x7f33caf5a8c8 The above code snip is part of an execution flow of function _M_extract_int() in libstdc++. I don't understand the meaning of the two compares. I think 0xffffffff80000000 is the top [...] read more
I'm working on an assignment in which I have to generate a random number of variable sizes, store each individual byte inside of an array, and then reconstruct that number by concatenating the bytes. For example, if our number is the 16 bit binary 1100001111110000, we would have one function [...] read more
I'm currently attempting to compile a Modelica program in Dymola. I have been running into issues which says the compiler is out of heap space (fatal error C1060), the total size of array must not exceed 0x7fffffff bytes (error C2148) and warning C4307: '*': signed integral constant overflow. I've tried [...] read more
X32 is an ABI for amd64/x86_64 CPUs using 32-bit pointers. The idea is to combine the larger register set of x86_64 with the smaller memory and cache footprint resulting from 32-bit pointers. It provides up to about a 40% speedup. See Difference between x86, x32, and x64 architectures on Stack [...] read more
My Spring Boot 2.3.1 app with SCS Hoshram.SR6 was using the Kafka Streams Binder. I needed to add a Kafka Producer that would be used in another part of the application so I added the kafka binder. The problem is the producer is not working, throwing an exception: 19:49:40.082 [scheduling-1] [...] read more
I tried to compile the following code: extern "C" { #include "netcdf.h" } int main() { const int Ntime = 336; const int Nlon = 1442; const int Nlat = 1021; double* dhsum_vals = new double[Ntime * Nlat * Nlon]; } When compiling with the 32-bit version, I get the [...] read more
i'm using a noise function inspired by libnoiseforjava to try and generate roads. (See below) public class VoronoiNoise { private static final double SQRT_2 = 1.4142135623730950488; private static final double SQRT_3 = 1.7320508075688772935; private long seed; private short distanceMethod; private final double frequency; public VoronoiNoise(long seed, double frequency, short distanceMethod) [...] read more
I'm trying to use Spring Cloud Stream from Kotlin. I wrote a simple consumer as follows: @Bean fun log(): Consumer<Person> { return Consumer<Person> { person: Person -> println("Received: ${person.name}") } } Spring Cloud Stream does not find this consumer and quits immediately. It doesn't give an error, but just terminates. [...] read more
I got some numbers and I need to get how much they should be shifted for their lower bit to be at position 0. ex: 0x40000000 => 30 because 0x40000000 >> 30 = 1 768 = 512+256 => 8 This works if (Math.log2(x) == 31) return 31; if (Math.log2(x) > [...] read more
I have an infinite map generator. It works well with positive coordinates. Positive coordinates generation 1 But on negative coordinates I have this trash: Negative coordinates broken generation 2 void generateChunk(int x0, int y0) { Chunk chunk = new Chunk(x0, y0); for(int yTile = 0; yTile < Chunk.CHUNK_SIZE; yTile++) { [...] read more
We have a working demo between React and Spring Boot Data Geode using rSocket for fire & forget, request response and request stream but when we try and use request channel we get error: org.springframework.messaging.MessageDeliveryException: Destination 'quotes' does not support REQUEST_CHANNEL. Supported interaction(s): [REQUEST_STREAM] So far on web it looks [...] read more
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
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
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
I am trying to translate the book Game Coding Complete by Mike McShaffry 4E to modern C++17 standard and faced with the code of Mersenne Twister by Takuji Nishimura and Makoto Matsumoto. Is it right to convert random generator code from book like that: from: #include <ctime> #define CMATH_N 624 [...] read more
I am working on a median filter on the ESP32 board. This median filter is based on a circular buffer. I implemented the filter into the main.c and it worked just fine. However as I created a custom library and called the function from the main.c the ESP32 just reboots [...] read more
I am trying to boot linux on a zedboard and monitor all memory accesses through Programmable Logic. We're first trying to boot linux with a start address above 0x40000000. I want all the memory request has to passed through the PL and PL will access the DDR for read/store. I [...] read more
i am developing desktop app (memory scanner). the core of the app is kernel driver and dll who communicate with each other. in my kernel driver i use all the low level function of Nt and Zw undocumented Functions i success to get from random process: * all the modules [...] read more
i'm make my first OpenCV Plugin using C++. But, it has some issue. 1. Image glitch 2. Memory leak 화면-기록-2021-03-07-오전-12 23 13 [https://user-images.githubusercontent.com/16532326/110211847-cd2abd80-7edb-11eb-9000-b29fa03275e6.gif] This is what it running looks like. EXPECTED BEHAVIOR Get the document of drawing picture and export only draw lines. SOURCE All source Xcode OSX 12.4 or [...] read more
I am writing selenium tests for django. I want to login a user with OTP through UI using selenium. After login , I get the setup page where I am supposed to enter a 6 digit token generated by google authenticator. django-two-factor-auth stores a secret key per user in table [...] read more
I am trying to generate a procedural terrain using perlin noise. Before, I was just creating a 1000 * 1000 vertice terrain so I just had a simple function that would fill the height map with the noise values. However now I am trying to generate a terrain that generates [...] read more
When I was trying the android nn code, found these in Conv2D.cpp: tflite::Dims<4> im2colDim; \ im2colDim.sizes[3] = (int)getSizeOfDimension(outputShape, 0); \ im2colDim.sizes[2] = (int)getSizeOfDimension(outputShape, 1); \ im2colDim.sizes[1] = (int)getSizeOfDimension(outputShape, 2); \ im2colDim.sizes[0] = (int)inDepth * filterHeight * filterWidth; \ \ im2colDim.strides[0] = 1; \ for (int i = 1; i < [...] read more
I am trying to use the fdlibm library in C to compute sin of a large number. I used the code from this link: http://www.netlib.org/fdlibm/ and downloaded the folder "s_sin.c plus dependencies". When I run the c code in that folder "s_sin.c", I get the following error: > Undefined symbols [...] read more
I'm doing a cpu and memory stress test on windows server 2016 and 2019 When I run it on the virtual server the results are successful 100% load Not enough load occurs when I run it on physical server How can i solve this situation **cpu_stress** <# .EXAMPLE .\cpu_stress.ps1 This [...] read more
I am at a dead end after spending the last year of my life building a PySide2 application that rapidly displays data using a TreeWidget. After starting the application, the data is appended without issue. However, after a few minutes, the program becomes very unstable/slow and eventually becomes unresponsive. Sometimes [...] read more
I cam cross a fast good approximation routine from celt as (https://chromium.googlesource.com/chromium/deps/opus/+/1.0.x/celt/mathops.h), you can see code as below: /** Base-2 exponential approximation (2^x). */ static inline float celt_exp2(float x) { int integer; float frac; union { float f; opus_uint32 i; } res; integer = floor(x); if (integer < -50) return [...] read more
Do I need to set the value of VkAttachmentDescription::samples to a power of 2 or are arbitrary values allowed, as long as they don't exceed the maximum supported by the hardware? I'm really confused about this. The samples field is of type VkSampleCountFlagBits, which is declared in the following way [...] read more
I'm in the process of implementing a remote camera control app with Canons EDSDK. My camera is a Canon PowerShot SX 70 HS. So far everything seems to work, except for the functionality to save the taken picture to the host-PC. My understanding of the needed workflow is the following: [...] read more
I am using Visual Studio 2019 Community edition. I have the following C++ code snippet: long long l = 0x80000000; assert(l > 0); //true l = -0x7fffffff; assert(l < 0); // true l = -0x80000000; assert(l < 0); // FALSE I expect -0x80000000 to end up sign-extended to 64-bit value [...] read more
I am confused about the hash function. This is a good hash function private int hash(K key) { return (key.hashCode() & 0x7fffffff) % M; } How would I turn that into a very bad hash function, would it be like this? private int hash(K key) { return (key.hashCode() & 17) [...] read more
When I was playing with compiler sanitizers, I was confused by this linking error when only LSAN and UBSAN are enabled on clang++. Note that the linking problem disappeared when I removed -fsanitize=leak or added these flags together: -fsanitize=leak -fsanitize-trap=undefined. Also note that this strange linking error seemed to only [...] read more
I just wanted to see how subTree array is changing while i am iterating over dfs() function. enter image description here [https://i.stack.imgur.com/LtIk0.png] Here is the code: #include<bits/stdc++.h> using namespace std; #define w(x) int x; cin>>x; while(x--) #define nl "\n" #define fr(i,t) for(int i=0;i<t;i++) #define fr1(i,a,b) for(int i = a; i<b; [...] read more
I need to pass some data over from Go to an '300 es' shader. The data consists of two uint16s packed into a uint32. Each uint16 represents a half-precision float (float16). I found some PD Java code that looks like it will do the job, but I am struggling with [...] read more
I am working through a Node.js tutorial and we just started working with Mongoose. Everything has been going great until today. I turned on my computer and opened WebStorm. I went to run what we had last worked on and I get the following stack trace: /usr/bin/node /home/doug/Documents/node-course/task-manager/src/db/mongoose.js /home/doug/Documents/node-course/task-manager/node_modules/bson/index.js:41 BSON.BSONRegExp [...] read more
I am running a Powershell command to add a rule to my Local Group Policy Editor for Windows Firewall with Advanced Security - Local Group Policy Object. For example, this is from ConfigureRemotingForAnsible.ps1 script. Function Enable-GlobalHttpFirewallAccess { Write-Verbose "Forcing global HTTP firewall access" # this is a fairly naive implementation; [...] read more
For gcc 9.3.0, when I try to print it as int x = 0x7fffffff; printf("%d", !(x+x+1+1)); it gives me 0. But when I try to print it as int temp = (x+x+1+1); temp = !temp; printf("%d", temp); it gives me 1 as expected. What happens? read more
When I try to complete float2int with the following function int float2int(unsigned uf) { int s_ = uf>>31; int exp_ = ((uf&0x7f800000)>>23)-127; int frac_ = (uf&0x007fffff)|0x00800000; if(!(uf&0x7fffffff)) return 0; if(exp_ > 31) return 0x80000000; if(exp_ < 0) return 0; if(exp_ > 23) frac_ <<= (exp_-23); else frac_ >>= (23-exp_); if(!((frac_>>31)^s_)) [...] read more
I am using minikube v1.11.0 on Microsoft Windows 10 Pro . my minikube stopped frequently ,Find minikube status Minikube Status: type: Control Plane host: Running kubelet: Running apiserver: Stopped kubeconfig: Configured minikube logs: Failed to list *v1.Service: Get https://10.96.0.1:443/api/v1/services?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: connect: connection refused Failed to list *v1.Namespace: Get [...] read more
I'm confused by this. The compiler is complaining about an unresolved external symbol... but if I add a parameter to it, it still knows to complain about the added parameter. enter image description here [https://i.stack.imgur.com/cxZw0.jpg] The function definition with the types and macros, in util.h (which is already included by [...] read more
I'm trying to find the minimum of an array which has exactly 4 elements. Each element is a signed int type, but only non-negative numbers are used, and -1 is used to represent an invalid value. The instructions generated for the 2nd version is using SSE which uses SIMD shuffle [...] read more
EDIT: Clarification: If I have an array int* a = new int[10], I want to get a pointer to a, but only the values from 0 to 5, without having to allocate another array for those values. Original post: I created a small class to fuzz my functions, but the [...] read more
First of all I would like to notice that I am not experienced iOS developer, I am writing app in React Native. The essence of the problem: If my app was swiped away and push notification from FCM arrived, I would like to send network request in response to user [...] read more
I'm programming tethering for the canon camera in Qt under Mac OSX and for some reason my handlers for sdk are not called. When I want to shoot with camera it's all goes well but my photo is not downloaded because EdsSetObjectEventHandler is not called. BUT for some reason when [...] read more
I'm trying to read the memory of a process. The actual code loops through the process' memory and searches for values but this is the general idea. I'm compiling for x64 and attempting to read x64 processes. This code fails after the call to VirtualProtectEx with either error code 5 [...] read more
I'm using MSVC++. If I define an std::array with a size bigger than 2^31 - 1 I get this error: > C2148 total size of array must not exceed 0x7fffffff bytes That makes me deduce that the type for the size is a signed 32 bit integer. But why using [...] read more
I have a function that does rounding operation as shown below. It takes 64bit integer as input and gives 32bit integer as output. While converting, a factor of 0x40000000 is being added to the input. What is the reason behind it? int rounder(long long int in) { INT64 out; if [...] read more
I want to print integer value that converted from hexadecimal value but i only could print hexadecimal value. #include <iostream> #include <boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; cpp_int dsa("0xFFFFFFFFFFFFFFFF"); cpp_int daa("9223372036854775807"); daa = ((daa * 64) + daa); cout << std::hex<<dsa <<std::showbase<< endl; cout <<dsa << endl; cout <<daa << endl; cout [...] read more
I'm trying to implement my own PHP function to generate codes for Google Authenticator. I do it for fun and to learn something new. Here's what I did: function twoFactorAuthorizationCode(string $secretBase32, int $digitsCount): string { $counter = (int) (time() / 30); $secret = Base32::decode($secretBase32); $hash = hash_hmac('sha1', $counter, $secret, true); [...] read more
I'm currently working on win32 application that uses sha1 hash on strings to generate keys for my map. I want to use the hash as DWORD, so I can compute some calculations between hashes. Since sha1 hash reproduces 160-bit hash values, I created a struct with 5 DWORD (32-bit * [...] read more
As an exercise I have to write the following function: multiply x by 2, saturating to Tmin / Tmax if overflow, using only bit-wise and bit-shift operations. Now this is my code: // xor MSB and 2nd MSB. if diferent, we have an overflow and SHOULD get 0xFFFFFFFF. otherwise we [...] read more
I'm trying to learn C++ using "MUD Game Programming" and I am working through the examples, but when I try to erase a connection from a vector I get an error: "Aborted (core dumped)." This usually happens when erasing the last one from the vector. I have tried solutions such [...] read more
I have some legacy code that works with UTF8/16 conversions and wstream-s. It has been written on VS08-VS10 and it assumes that mbstate_t's type is int. It uses it to check on some states like while(_State & 0x80000000 && ...) and unsigned n = _State & 0x7FFFFFFF; if(n<=0x3F)... But now [...] read more
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
I wrote the following code to understand the bit-wise right shift operation, unsigned long a = 0; unsigned long b = 0xFFFFFFFF; a = ~a; // now a is equal to b a = a >> 1; b = b >> 1; printf("a = %x\n", a); // result: a = [...] read more