unsigned Questions
13
Solved
I know, the question seems to be strange. Programmers sometimes think too much. Please read on...
In C I use signed and unsigned integers a lot. I like the fact that the compiler warns me if I do t...
Janetjaneta asked 4/2, 2009 at 16:6
9
I work with a lot of calculation code written in c++ with high-performance and low memory overhead in mind. It uses STL containers (mostly std::vector) a lot, and iterates over that containers almo...
Washington asked 19/4, 2011 at 9:5
7
Solved
I'm working on a page that processes IP address information, but it's choking on the fact that integers are signed. I am using bitwise operators to speed it up, but the 64th bit (signed/unsigned fl...
Thacker asked 15/12, 2009 at 16:7
18
Solved
What is the correct way of iterating over a vector in C++?
Consider these two code fragments, this one works fine:
for (unsigned i=0; i < polygon.size(); i++) {
sum += polygon[i];
}
and this o...
2
Solved
For an app, I need a 64bit unsigned int. Looking at dart documentation I did not see how to exactly go about declaring one.
Can anyone tell me how this is done? I will use this "64bit unsigned int...
3
Solved
I'm writing a datalog parser for a robot controller, and what's coming in from the data log is a number in the range of 0 - 65535 (which is a 16 bit unsigned integer if I'm not mistaken). I'm tryin...
Impulsive asked 31/1, 2010 at 4:48
16
Solved
How can I declare an unsigned short value in Java?
5
I have a function declared as:
void foo(unsigned int x)
How can I check that foo() is not receiving negative numbers?
I'd like that if I call foo(-1) an exception is thrown,
but of course since ...
6
Solved
I want to increment an unsigned integer from multiple threads.
I know about Interlocked.Increment, but it does not handle unsigned integers. I could use lock(), but I would rather not if possible ...
Missal asked 1/6, 2009 at 12:29
3
Solved
I'm new to VHDL and am having trouble figuring out which data types are appropriate to use where. If I understand correctly, for synthesis, all top level entity ports should be declared either std_...
1
Solved
Is there a signed variant of size_t in standard C++? Meaning exactly same bit size as size_t but signed.
Of course I can do:
#include <type_traits>
using signed_size_t = std::make_signed_t<...
2
Solved
I'm curious why the signed keyword exists because I believe most integers and other variables are signed by default. Putting the signed keyword before int virtually does nothing. What is it used fo...
7
Solved
3
Solved
This is what I have, currently. Is there any nicer way to do this?
import struct
def int32_to_uint32(i):
return struct.unpack_from("I", struct.pack("i", i))[0]
Frantic asked 9/5, 2013 at 0:4
2
Solved
Take a look:
use std::convert::{From, TryFrom};
fn main() {
let size: usize = 42;
let good: u128 = u128::try_from(size).unwrap(); // works fine
let bad: u128 = u128::from(size); // doesn't comp...
Poltergeist asked 10/7, 2020 at 10:32
10
I got warning:
Pe186 "Pointless comparison of unsigned int with zero"
when I tried to compile the following code:
for(clLoop = cpLoopStart; clLoop >= 0; clLoop--)
{
//Do something
}
I...
Actinic asked 21/2, 2011 at 13:12
2
Solved
I have a vector:
std::vector<int> vec = {1, 2, 3};
And I want to make a reverse for loop. It works, when I write:
for(int i = vec.size() - 1; i >= 0; --i) {
std::cout << i <<...
6
Solved
3
When I build a simple program that lets the user enter a number
(size_t num), I don't understand why input of a negative number
results in a huge number instead of an error message.
size_t num;
pr...
3
Solved
I have a string in PHP (came from some data source), which represents a formatted unsigned 32-bit integer.
I need to store it into a MySQL database as a signed 32-bit integer, so that later I can r...
3
I have found out that both mul and imul can be used to multiply a signed number to an unsigned number.
For example:
global _start
section .data
byteVariable DB -5
section .text
_start:
mov al...
Everard asked 3/8, 2017 at 22:46
1
Solved
I've come across this behavior of std::gcd that I found unexpected:
#include <iostream>
#include <numeric>
int main()
{
int a = -120;
unsigned b = 10;
//both a and b are represent...
Gosh asked 17/12, 2019 at 17:57
2
Solved
If I'm using a library which currently uses a particular numeric type alias, e.g.
typedef uint32_t library_type;
void library_function(library_type x);
How would I ensure that code which needs ...
3
I'm using template function:
template<typename T> void func(const T& value)
{
obj->func(value);
}
where obj is object of class:
void my_object::func(int64_t value) { ... }
void my...
Breakthrough asked 1/1, 2011 at 15:29
4
Solved
I am building a DLL which will be used by C++ using COM.
Please let me know what would be the C# equivalent of C++ 64-bit unsigned long long.
Will it be ulong type in C# ?
Please confirm.
Thanks,...
Nevillenevin asked 17/9, 2013 at 13:47
© 2022 - 2024 — McMap. All rights reserved.