unsigned-integer

Render to 16bits unsigned integer 2D texture in WebGL2

99封情书 提交于 2020-01-25 04:36:05
问题 As stated in the WebGL 2 official specs or docs (look here), gl.RGBA16UI internal size format is a color-renderable format. That means I should be able to render to a RGBA16UI texture. I can easily fill a texture with an UInt16Array and then use it. But I fail filling a texture rendering into it with a shader. Then, I only get zeros when I sample the values in the next shader. Did anyone already succeed in rendering to an unsigned integer texture with WebGL 2 ? I would be very grateful, I'm

Decoding the scanned barcode value to int value

可紊 提交于 2020-01-16 00:54:12
问题 When I scan the barcode and I get some value if it is Equal=2 then I need to display with == and if it is Equal=3 then I need to display with = and if the value is 4 then invalid. But Scanned Barcode are of integer value -- when decode using NSASCII it is displaying only till value 127 after that it is showing invalid results. Eg: if my Barcode value = 9699 the result value= jem then my added result value= jem= actualstring value= %å asc value id only showing 37 Here is my code: - (void)

unsigned integers in C [closed]

本秂侑毒 提交于 2020-01-11 05:14:05
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . While i am running the program below it outputs like 109876543210-1-2-3-4-5-6-78-9-10-11-12-and s0 on. Why so? What is the concept of unsigned integer? main () { unsigned int i; for (i = 10; i >= 0; i--) printf (

How can I get the size of an std::vector as an int?

妖精的绣舞 提交于 2019-12-31 11:03:49
问题 I tried: #include <vector> int main () { std::vector<int> v; int size = v.size; } but got the error: cannot convert 'std::vector<int>::size' from type 'std::vector<int>::size_type (std::vector<int>::)() const noexcept' {aka 'long unsigned int (std::vector<int>::)() const noexcept'} to type 'int' Casting the expression to int like this: #include <vector> int main () { std::vector<int> v; int size = (int)v.size; } also yields an error: error: invalid use of member function 'std::vector<_Tp,

Converting a program to accept unsigned integer

拥有回忆 提交于 2019-12-31 05:49:12
问题 I have written this program to perform ulam's conjecture on an entered integer, however when entering a number such as 38836, it exceeds the bounds for a 16 bit signed integer. I believe using unsigned would fix my issue, however I cannot figure out how to adjust this code segment to accept an unsigned integer. Any Help would be very much appreciated! DOSSEG .MODEL SMALL, BASIC, FARSTACK EXTRN GETDEC:FAR EXTRN NEWLINE:FAR EXTRN PUTDEC:FAR EXTRN PUTSTRNG:FAR .STACK 256 .DATA NUM DW ? CNT DW 0

How can I safely average two unsigned ints in C++?

微笑、不失礼 提交于 2019-12-28 08:07:24
问题 Using integer math alone, I'd like to "safely" average two unsigned ints in C++. What I mean by "safely" is avoiding overflows (and anything else that can be thought of). For instance, averaging 200 and 5000 is easy: unsigned int a = 200; unsigned int b = 5000; unsigned int average = (a + b) / 2; // Equals: 2600 as intended But in the case of 4294967295 and 5000 then: unsigned int a = 4294967295; unsigned int b = 5000; unsigned int average = (a + b) / 2; // Equals: 2499 instead of 2147486147

uint8 little endian array to uint16 big endian

╄→гoц情女王★ 提交于 2019-12-24 01:17:45
问题 In Python2.7, from an USB bulk transfer I get an image frame from a camera: frame = dev.read(0x81, 0x2B6B0, 1000) I know that one frame is 342x260 = 88920 pixels little endian, because that I read 2x88920 = 177840 (0x2B6B0) from the bulk transfer. How can I convert the content of the frame array that is typecode=B into an uint16 big endian array? 回答1: Something like this should do the trick: frame_short_swapped = array.array('H', ((j << 8) | i for (i,j) in zip(frame[::2], frame[1::2]))) It

How do I perform a proper unsigned right shift in PHP?

拟墨画扇 提交于 2019-12-23 18:54:38
问题 Is this possible to get the same results in PHP and Javascript? Example: Javascript <script> function urshift(a, b) { return a >>> b; } document.write(urshift(10,3)+"<br />"); document.write(urshift(-10,3)+"<br />"); document.write(urshift(33, 33)+"<br />"); document.write(urshift(-10, -30)+"<br />"); document.write(urshift(-14, 5)+"<br />"); </script> output: 1 536870910 16 1073741821 134217727 PHP function uRShift($a, $b) { if ($a < 0) { $a = ($a >> 1); $a &= 2147483647; $a |= 0x40000000;

QSpinBox with Unsigned Int for Hex Input

筅森魡賤 提交于 2019-12-23 08:00:11
问题 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, 0xFFFFFFFF]. The largest a normal QSpinBox can go is 0x7FFFFFFF. Answering my own question here, the solution I came up with is to simply force the int to be treated like an unsigned int, by reimplementing the relevant

Convert a string to an 8-bit signed integer in python

柔情痞子 提交于 2019-12-23 04:56:10
问题 I'm trying to patch together a motor control system using python and ctypes and one of the things I need to do is take an text input and convert it to an 8-bit signed integer. Below is the documentation for the function I'm trying to call. The text that should be input into the program is 'EPOS2' The data type definition is as shown below (note that 'char*' equates to an 8-bit signed integer) So How do I convert 'EPOS2' to a value between -128 and 127? Ultimately what I'm trying to do is