-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|630|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> replace two half bytes with one byte?

Posted : Monday, 09 January 2017, 10:23
spinal
That title might not help but...

I have 1 byte that I want to overlap 50% over two other bytes, leaving the remaining outer half bytes untouched...



Like always, I seem to be nrealy there, just not quite

Any ideas?

-=-=-
Download ''Don't Flip Out!'' Directly to your OUYA! (Click Here).
Posted : Monday, 09 January 2017, 10:58
Jayenkai
Like so..?

(Blitz2D/3D/Plus)


-=-=-
''Load, Next List!''
Posted : Monday, 09 January 2017, 13:09
spinal
something like that, yup.
Posted : Tuesday, 04 April 2017, 09:46
spinal
hmmmm, need to update this to use a variable instead of the '4' for example, add the first X bytes to my other byte. So say I want to drop a 5 bit number starting at bit 2 of my 8bit number... ???

-=-=-
Download ''Don't Flip Out!'' Directly to your OUYA! (Click Here).
Posted : Tuesday, 04 April 2017, 14:27
shroom_monk
Here's a simple C++ example that I think does what you want. |edit| (although on subsequent readings, I'm not quite sure what you're getting at with the second sentence; I think what I've done covers the first) |edit| It can be made more concise than this, of course, but I've spread it out to make it easier to follow.



-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Posted : Friday, 07 April 2017, 02:58
spinal
Thanks for the help, but unfortunately, I changed my data size to 4 bits, so I''l be going with the first option again.

Sorry shroom.

-=-=-
Download ''Don't Flip Out!'' Directly to your OUYA! (Click Here).