Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   bitshift (http://www.velocityreviews.com/forums/t805720-bitshift.html)

Bill Cunningham 11-08-2011 11:05 PM

bitshift
 
I wrote some code that is now gone or I'd post it. This code took a jpeg
file of around 45Mb and I used the tilde operator to turn it "inside out". I
believe I was successful and when I tried to "reshift" the bits it didn't
work too well. Here's s snippet of what I can remember.

int a,b;
a=~b;

while ((a=fgetc(fr))!=EOF)
fputc(a,fw);

This might not be exact but once the shift was made and the file was
rendered incompatible it couldn't be restored.

Bill



Lew Pitcher 11-09-2011 12:01 AM

Re: bitshift
 
On November 8, 2011 18:05, in comp.lang.c, nospam@nspam.invalid wrote:

> I wrote some code that is now gone or I'd post it. This code took a
> jpeg
> file of around 45Mb and I used the tilde operator to turn it "inside out".
> I believe I was successful and when I tried to "reshift" the bits it
> didn't work too well. Here's s snippet of what I can remember.
>
> int a,b;
> a=~b;
>
> while ((a=fgetc(fr))!=EOF)
> fputc(a,fw);
>


Not quite. Your original code was "to take an ELF format file and turn it
inside out". And the code was somewhat more involved than the sample you
posted above.

> This might not be exact but once the shift was made and the file was
> rendered incompatible it couldn't be restored.
>
> Bill
>
>


Yes, Bill, and we discussed the problem when you posted your code.

You can find your original posting at
http://groups.google.com/group/comp....d65513a89893b8
and the entire thread (including the analysis of your code issues) at
http://groups.google.com/group/comp....2175a9c67ec50b

--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------




All times are GMT. The time now is 01:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.