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

Mon, 09 Jan 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?

-=-=-
Check out my excellent homepage!
Mon, 09 Jan 2017, 10:58
Jayenkai
Like so..?

(Blitz2D/3D/Plus)


-=-=-
''Load, Next List!''
Mon, 09 Jan 2017, 13:09
spinal
something like that, yup.
Tue, 04 Apr 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... ???

-=-=-
Check out my excellent homepage!
Tue, 04 Apr 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!
Fri, 07 Apr 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.

-=-=-
Check out my excellent homepage!