logic
Determine the sign of a 32 bit int
Using ONLY: ! ~ & ^ | + << >> NO LOOPS I need to determine the sign of a 32 bit integer and I need to return 1 if positive, 0 if 0 and -1 if negative.[详细]
2023-04-03 21:32 分类:问答Very simple masking
In 3 operations how can I turn a byte into a 32 bit int that matches this: 0x1fffe I can only explicitly access a byte at a time thus I start with 0xFF and then shift it.[详细]
2023-04-03 21:29 分类:问答How to multiply an int with a fraction
I need to multiply an int by a fraction using bitwise operators without loops and such. For example, I need to multiply by x by 3/8.[详细]
2023-04-03 21:08 分类:问答A bug I can't seem to spot, faulty logic?
Problem description: Take a stack of coins all heads up.Upturn the topmost coin and then proceed:take the top 2 coins and upturn as a single stack (tail, head becomes when upturned and placed back on[详细]
2023-04-03 20:03 分类:问答Repeating "events" in a calendar: CPU vs Database
I\'m building a calendar system from the ground up (requirement, as I\'m working with a special type of calendar alongside Gregorian) , and I need some help with logic. I\'m writing the application in[详细]
2023-04-02 22:52 分类:问答PHP auto notification via email, the logic behind this
For example, I want my client to be notify via email on a set date and time in the future. Can PHP do this even if nobody is visiting the website?[详细]
2023-04-02 21:40 分类:问答Type of the quotient of two integers
Consider the following: int num = 5; double total = num / 2; Is it correct to say that 开发者_C百科the quotient of num / 2 is not a double because you need to parse the int to double?The technical[详细]
2023-04-02 19:19 分类:问答Robust way to hide bits of text during a find-and-replace?
Let\'s say I have some text: <hello> <world> <:how> are <you> Now I want to HTML-encode it so that the <>s don\'t mess things up. But <:how> is special because i[详细]
2023-04-02 18:24 分类:问答Signal-Slot makes a mess
I am trying to create a image-saving application using Qt. Now the stub class ImageSaver:public QObject[详细]
2023-04-02 16:45 分类:问答Longest recurring cycle in its decimal fraction - a bug or a misunderstanding?
This is fairly \'math-y\' but I\'m posting here because it\'s a Project Euler problem, & I have working code that presumably has bugs in it.[详细]
2023-04-02 04:44 分类:问答