Search Results

Search found 1100 results on 44 pages for 'bitwise operators'.

Page 6/44 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Twitter search API VS Operators

    - by supermogx
    I've found this page about the Twitter search API and some operators : http://search.twitter.com/operators But is it possible to make a search like : All posts containing the words "ipod OR ipad" AND all posts containing the words "funny OR joke" ? Like : "happy AND hour" OR "ipod AND ipad" this doesn't look like it's possible.

    Read the article

  • How to make ARGB transparency using bitwise operators.

    - by Smejda
    I need to make transparency, having 2 pixels: pixel1: {A, R, G, B} - foreground pixel pixel2: {A, R, G, B} - background pixel A,R,G,B are Byte values each color is represented by byte value now I'm calculating transparency as: newR = pixel2_R * alpha / 255 + pixel1_R * (255 - alpha) / 255 newG = pixel2_G * alpha / 255 + pixel1_G * (255 - alpha) / 255 newB = pixel2_B * alpha / 255 + pixel1_B * (255 - alpha) / 255 but it is too slow I need to do it with bitwise operators (AND,OR,XOR, NEGATION, BIT MOVE)

    Read the article

  • Concept of bit fields

    - by user1369975
    Whenever I read a code like this: struct node { int x : 2; int p : 4; }n; with bit fields involved, I get really confused, as to how they are represented in memory, what is sizeof(n) etc., how does it differ with normal members of structures? I tried referring K&R and http://en.wikipedia.org/wiki/Bit_field but they little to remove my confusion. What concepts of bit fields am I failing to grasp?

    Read the article

  • Arithmetic + and Bitwise OR

    - by Mohanavel
    Is there any difference between Arithmetic + and bitwise OR. For the below operation i used arithmetic operation, my friend told that this is wrong. In what way this is differing. uint a = 10; uint b = 20; uint arithmeticresult = a + b; uint bitwiseOR = a | b; Both the results are 30.

    Read the article

  • How do I overload an operator for an enumeration in C#?

    - by ChrisHDog
    I have an enumerated type that I would like to define the , <, =, and <= operators for. I know that these operators are implictly created on the basis of the enumerated type (as per the documentation) but I would like to explictly define these operators (for clarity, for control, to know how to do it, etc...) I was hoping I could do something like: public enum SizeType { Small = 0, Medium = 1, Large = 2, ExtraLarge = 3 } public SizeType operator >(SizeType x, SizeType y) { } But this doesn't seem to work ("unexpected toke") ... is this possible? It seems like it should be since there are implictly defined operators. Any suggestions?

    Read the article

  • Strlen of MAX 16 chars string using bitwise operators

    - by fabrizioM
    The challenge is to find the fastest way to determine in C/C++ the length of a c-string using bitwise operations in C. char thestring[16]; The c-string has a max size of 16 chars and is inside a buffer If the string is equal to 16 chars doesn't have the null byte at the end. I am sure can be done but didn't got it right yet. I am working on this at the moment, but assuming the string is memcpied on a zero-filled buffer. len = buff[0] != 0x0 + buff[1] != 0x0 + buff[2] != 0x0 + buff[3] != 0x0 + buff[4] != 0x0 + buff[5] != 0x0 + buff[6] != 0x0 + buff[7] != 0x0 + buff[8] != 0x0 + buff[9] != 0x0 + buff[10] != 0x0 + buff[11] != 0x0 + buff[12] != 0x0 + buff[13] != 0x0 + buff[14] != 0x0 + buff[15] != 0x0;

    Read the article

  • Infix to Postfix and unary/binary operators

    - by Jaapjan
    I have a piece of code that converts an infix expression to an expression tree in memory. This works just fine. There's just one small trouble. I just connect work out how to involve the unary operators correctly (the right associative ones). With the following infix expression : +1 + +2 - -3 - -4 I would expect an RPN of: 1+2++3-4-- Yet, none of the online infix-post converters I can find handle this example in the way I would expect. Does anyone have a clear explanation of handling right associative operators, specifically the binary ones that can be mistaken for the unary ones?

    Read the article

  • Simple Python Challenge: Fastest Bitwise XOR on Data Buffers

    - by user213060
    Challenge: Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python str type since this is traditionally the type for data buffers in python. Return the resultant value as a str. Do this as fast as possible. The inputs are two 1 megabyte (2**20 byte) strings. The challenge is to substantially beat my inefficient algorithm using python or existing third party python modules (relaxed rules: or create your own module.) Marginal increases are useless. from os import urandom from numpy import frombuffer,bitwise_xor,byte def slow_xor(aa,bb): a=frombuffer(aa,dtype=byte) b=frombuffer(bb,dtype=byte) c=bitwise_xor(a,b) r=c.tostring() return r aa=urandom(2**20) bb=urandom(2**20) def test_it(): for x in xrange(1000): slow_xor(aa,bb)

    Read the article

  • How to modify a given class to use const operators

    - by zsero
    I am trying to solve my question regarding using push_back in more than one level. From the comments/answers it is clear that I have to: Create a copy operator which takes a const argument Modify all my operators to const But because this header file is given to me there is an operator what I cannot make into const. It is a simple: float & operator [] (int i) { return _item[i]; } In the given program, this operator is used to get and set data. My problem is that because I need to have this operator in the header file, I cannot turn all the other operators to const, what means I cannot insert a copy operator. How can I make all my operators into const, while preserving the functionality of the already written program? Here is the full declaration of the class: class Vector3f { float _item[3]; public: float & operator [] (int i) { return _item[i]; } Vector3f(float x, float y, float z) { _item[0] = x ; _item[1] = y ; _item[2] = z; }; Vector3f() {}; Vector3f & operator = ( const Vector3f& obj) { _item[0] = obj[0]; _item[1] = obj[1]; _item[2] = obj[2]; return *this; }; Vector3f & operator += ( const Vector3f & obj) { _item[0] += obj[0]; _item[1] += obj[1]; _item[2] += obj[2]; return *this; }; bool operator ==( const Vector3f & obj) { bool x = (_item[0] == obj[0]) && (_item[1] == obj[1]) && (_item[2] == obj[2]); return x; } // my copy operator Vector3f(const Vector3f& obj) { _item[0] += obj[0]; _item[1] += obj[1]; _item[2] += obj[2]; return this; } };

    Read the article

  • using operators and functions for sql report charts (visual studio 2010)

    - by user1682566
    I want to create some charts using sql reporting services. But i am unable to use a lot of functions and operators in combination with my data-fields the following work(Stroke-data type is decimal): > =Fields!Stroke.Value > =Sum(Fields!Stroke.Value) > =First(Fields!Stroke.Value) > =Last(Fields!Stroke.Value) > =2+2394.12 the following dont work: > =Fields!Stroke.Value + 2 > =CStr(Fields!Stroke.Value) > =CDbl(Fields!Stroke.Value) > =Fields!Stroke.Value / Fields!Stroke.Value > =Sum(Fields!Stroke.Value) * 2 all other operators and functions(using Fields!Stroke.Value) dont work too

    Read the article

  • NASM shift operators

    - by Hudson Worden
    How would you go about doing a bit shift in NASM on a register? I read the manual and it only seems to mention these operators , <<. When I try to use them NASM complains about the shift operator working on scalar values. Can you explain what a scalar value is and give an example of how to use and <<. Also, I thought there were a shr or shl operators. If they do exist can you give an example of how to use them? Thank you for your time.

    Read the article

  • Ternary operators and variable reassignment in PHP

    - by TomcatExodus
    I've perused the questions on ternary operators vs. if/else structures, and while I understand that under normal circumstances there is no performance loss/gain in using ternary operators over if/else structures, I've not seen any mention of this situation. Language specific to PHP (but any language agnostic details are welcome) does the interpreter reassign values in situations like this: $foo = 'bar' $foo = strlen($foo) > 3 ? substr($foo, 0, 3) : $foo; Since this would evaluate to $foo = $foo; is this inefficient, or does the interpreter simply overlook/discard this evaluation? On a side note, what about: !defined('SECURE') ? exit : null;

    Read the article

  • Is It Worth Using Bitwise Operators In Methods?

    - by user1626141
    I am very new to Java (and programming in general, my previous experience is with ActionScript 2.0 and some simple JavaScript), and I am working my way slowly and methodically through Java: A Beginner's Guide by Herbert Schildt. It is an incredible book. For one thing, I finally understand more-or-less what bitwise operators (which I first encountered in ActionScript 2.0) do, and that they are more efficient than other methods for certain sums. My question is, is it more efficient to use a method that uses, say, a shift right, to perform all your divisions/2 (or divisions/even) for you in a large program with many calculations (in this case, a sprawling RPG), or is it more efficient to simply use standard mathematical operations because the compiler will optimise it all for you? Or, am I asking the wrong question entirely?

    Read the article

  • Official names for pointer operators

    - by FredOverflow
    What are the official names for the operators * and & in the context of pointers? They seem to be frequently called dereference operator and address-of operator respectively, but unfortunately, the section on unary operators in the standard does not name them. I really don't want to name & address-of anymore, because & returns a pointer, not an address. (A pointer is a language mechanism, while an address is an implementation detail. Addresses are untyped, while pointers aren't, except for void*.) The standard is very clear about this: The result of the unary & operator is a pointer to its operand. Symmetry suggests to name & reference operator which is a little unfortunate because of the collision with references in C++. The fact that & returns a pointer suggests pointer operator. Are there any official sources that would confirm these (or other) namings?

    Read the article

  • Why avoid increment ("++") and decrement ("--") operators in JavaScript?

    - by artlung
    I'm a big fan of Douglas Crockford's writing on JavaScript, particularly his book JavaScript: The Good Parts. It's made me a better JavaScript programmer and a better programmer in general. One of his tips for his jslint tool is this : ++ and -- The ++ (increment) and -- (decrement) operators have been known to contribute to bad code by encouraging excessive trickiness. They are second only to faulty architecture in enabling to viruses and other security menaces. There is a plusplus option that prohibits the use of these operators. This has always struck my gut as "yes, that makes sense," but has annoyed me when I've needed a looping condition and can't figure out a better way to control the loop than a while( a < 10 )do { a++ } or for (var i=0;i<10;i++) { } and use jslint. It's challenged me to write it differently. I also know in the distant past using things, in say PHP like $foo[$bar++] has gotten me in trouble with off-by-one errors. Are there C-like languages or other languages with similarities that that lack the "++" and "--" syntax or handle it differently? Are there other rationales for avoiding "++" and "--" that I might be missing? UPDATE -- April 9, 2010: In the video Crockford on JavaScript -- Part 5: The End of All Things, Douglas Crockford addresses the ++ issue more directly and with more detail. It appears at 1:09:00 in the timeline. Worth a watch.

    Read the article

  • Boost causes an invalid block while overloading new/delete operators

    - by user555746
    Hi, I have a problem which appears to a be an invalid memory block that happens during a Boost call to Boost:runtime:cla::parser::~parser. When that global delete is called on that object, C++ asserts on the memory block as an invalid: dbgdel.cpp(52): /* verify block type */ _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)); An investigation I did revealed that the problem happened because of a global overloading of the new/delete operators. Those overloadings are placed in a separate DLL. I discovered that the problem happens only when that DLL is compiled in RELEASE while the main application is compiled in DEBUG. So I thought that the Release/Debug build flavors might have created a problem like this in Boost/CRT when overloading new/delete operators. So I then tried to explicitly call to _malloc_dbg and _free_dbg withing the overloading functions even in release mode, but it didn't solve the invalid heap block problem. Any idea what the root cause of the problem is? is that situation solvable? I should stress that the problem began only when I started to use Boost. Before that CRT never complained about any invalid memory block. So could it be an internal Boost bug? Thanks!

    Read the article

  • operators computing direction

    - by amiad
    Hi all! I enqunterd something that I can't understand. I have this code: cout << "f1 * f1 + f2 * f1 - f1 / f2 is: "<< f1 * f1 + f2 * f1 - f1 / f2 << endl; All the "f"s are objects, and all the operators are overloaded. The weird this is that the first computarion is of the "/" operator, then the second "" and then the first "", after that - the operator "+" and at last - operator "-". So basicly - the "/" and "*" worked from right to left, and the "+" and "-" operators worked from left to right. I made another test... I checked this code: cout << "f1 * f1 / f2 is: " << f1 * f1 / f2 << endl; Now, the first operator was "*" and only then oerator "/". So now, it worked from left to right. Can someone help me underatand why is there diffrence in the directions? 10X!

    Read the article

  • Which are the fundamental stack manipulation operations?

    - by Aadit M Shah
    I'm creating a stack oriented virtual machine, and so I started learning Forth for a general understanding about how it would work. Then I shortlisted the essential stack manipulation operations I would need to implement in my virtual machine: drop ( a -- ) dup ( a -- a a ) swap ( a b -- b a ) rot ( a b c -- b c a ) I believe that the following four stack manipulation operations can be used to simulate any other stack manipulation operation. For example: nip ( a b -- b ) swap drop -rot ( a b c -- c a b ) rot rot tuck ( a b -- b a b ) dup -rot over ( a b -- a b a ) swap tuck That being said however I wanted to know whether I have listed all the fundamental stack manipulation operations necessary to manipulate the stack in any possible way. Are there any more fundamental stack manipulation operations I would need to implement, without which my virtual machine wouldn't be Turing complete?

    Read the article

  • Working with Temporal Data in SQL Server

    - by Dejan Sarka
    My third Pluralsight course, Working with Temporal Data in SQL Server, is published. I am really proud on the second part of the course, where I discuss optimization of temporal queries. This was a nearly impossible task for decades. First solutions appeared only lately. I present all together six solutions (and one more that is not a solution), and I invented four of them. http://pluralsight.com/training/Courses/TableOfContents/working-with-temporal-data-sql-server

    Read the article

  • Is Operator Overloading supported in C

    - by caramel23
    Today when I was reading about LCC(windows) compiler I find out it has the implemention for operator overloading . I'm puzzled because after a bit of googling , it has been confirm that operator overloading ain't support in standard C , but I read some people's comment mentioning LCC is ANSI-compliant . So my real question is , is LCC really standard C or it's just like objective-c , a C variant with object-oriented feature ?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >