473,395 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

memmove() loses bits...

Hi all,
I was working on bits and in the end moving them to another variabile
The original sequence is
00000000100011000000000000000000

while once moved with memmove() is

00000000000011000000000000000000

which is obviously different.

What could be the problem? Im moving bits from an unsigned to a float if
this may help.
thanx
Nov 14 '05 #1
5 1237

On Sat, 12 Jun 2004, niko wrote:

Hi all,
I was working on bits and in the end moving them to another variabile

[and somehow ends up with different bits]

Post a small, compilable program that demonstrates the problem.
Also make sure to tell us the 'sizeof' all relevant types (you
mentioned unsigned short and float; how many bytes are they on
your platform?).

[If you use tabs in your source code, run it through
http://www.contrib.andrew.cmu.edu/~ajo/usenetify2.c
before posting. Otherwise it will turn out unreadable.]

-Arthur
Nov 14 '05 #2
"niko" <se******@here.lol> writes:
Hi all,
I was working on bits and in the end moving them to another variabile
The original sequence is
00000000100011000000000000000000

while once moved with memmove() is

00000000000011000000000000000000

which is obviously different.

What could be the problem? Im moving bits from an unsigned to a float if
this may help.


Some (short!) sample code would be helpful, but my best guess is that
the floating-point value is being normalized. The behavior may depend
on how you're retrieving the bits, which you don't show us.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #3
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:
[If you use tabs in your source code, run it through
http://www.contrib.andrew.cmu.edu/~ajo/usenetify2.c
before posting. Otherwise it will turn out unreadable.]


blp@blp:~(0)$ wget http://www.contrib.andrew.cmu.edu/~ajo/usenetify2.c
--16:06:16-- http://www.contrib.andrew.cmu.edu/%7Eajo/usenetify2.c
=> `usenetify2.c'
Resolving www.contrib.andrew.cmu.edu... 128.2.4.154, 128.2.4.147
Connecting to www.contrib.andrew.cmu.edu[128.2.4.154]:80... connected.
HTTP request sent, awaiting response... 404 Not Found
16:06:17 ERROR 404: Not Found.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Nov 14 '05 #4
In article <87************@blp.benpfaff.org>,
Ben Pfaff <bl*@cs.stanford.edu> wrote:
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:
[If you use tabs in your source code, run it through
http://www.contrib.andrew.cmu.edu/~ajo/usenetify2.c
before posting. Otherwise it will turn out unreadable.]


Try

http://www.contrib.andrew.cmu.edu/~a...e/usenetify2.c

instead.
Nov 14 '05 #5

On Sun, 13 Jun 2004, Christian Bau wrote:

Ben Pfaff <bl*@cs.stanford.edu> wrote:
"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:
[If you use tabs in your source code, run it through
http://www.contrib.andrew.cmu.edu/~ajo/usenetify2.c
before posting. Otherwise it will turn out unreadable.]


Try
http://www.contrib.andrew.cmu.edu/~a...e/usenetify2.c
instead.


Yes indeed; thanks for the correction. Funny how I can't type
URLs on my own site correctly... ;)

-Arthur
Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Mac | last post by:
$ cat junk27.c #include <stdio.h> #include <string.h> int main (void) { printf("The difference between memcpy and memmove is %ld\n", (long int) memcpy - (long int) memmove); return 0; }
21
by: Method Man | last post by:
Just a few theoretical questions I had on 'memmove': 1. Is there ever a good reason to use memcpy instead of memmove? 2. Is memmove useful to copy structs (as opposed to = operator)? 3. In...
12
by: Ian | last post by:
I read the FAQ about the differences between memcpy() and memmove(). Apparently memmove() is supposed to be safer. Just to make sure I understand the concept of memmove(), can someone tell me if...
6
by: novice | last post by:
Please explain with an example whts the DIFFERENCE between "memcpy" and "memmove"
1
by: kyo guan | last post by:
Hi : python list object like a stl vector, if insert a object in the front or the middle of it, all the object after the insert point need to move backward. look at this code ( in python...
18
by: Kobu | last post by:
Hi, The addresses seens in C's "layer" aren't necessarily the same as the actual physical addresses in computer core (in fact, this is almost always true for big OSes because of memory...
5
by: xdevel | last post by:
Hi, anyone can make me an example where memmove does not cause a memory overlapping and where memcpy do it? Thanks
14
by: somenath | last post by:
Hi All, I am trying to understand the behavior of the memcpy and memmove. While doing so I wrote a program as mentioned bellow . #include<stdio.h> #include<stdlib.h> #include<string.h> ...
3
by: Chris | last post by:
Hello all, Not sure if this is off topic, if it is I apologise in advance. Is it safe to use memmove() on an array of objects? I create an array of Objects and I have a cursor to indicate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.