473,406 Members | 2,371 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,406 software developers and data experts.

Source Code for memcpy()

How does one get the source code for memcpy()?
Jun 8 '06 #1
11 17961

smnoff wrote:
How does one get the source code for memcpy()?


google ;)

Jun 8 '06 #2

smnoff wrote:
How does one get the source code for memcpy()?


By going to:

www.google.com

or, if one is slightly more informed:

www.gnu.org

or, even better still (advanced users only):

www.gnu.org/software/libc/

or, (for experts only):

by actually writing it

Jun 8 '06 #3
smnoff wrote:
How does one get the source code for memcpy()?


Why does one want the source code for memcpy?

[Not that there aren't reasons, but I'm curious as to what they are.]

Note that there is no "the" source code for memcpy. There will be
many sources: some cunningly optimised for a particular environment,
some written to make the intended effect clear; some written in ISO C,
some written in GNU C, some written in assembler ...

Was the Vax C runtime library written in C or Bliss or whatever?

--
Chris "the x. x member {}" Dollin
"Reaching out for mirrors hidden in the web." - Renaissance, /Running Hard/

Jun 8 '06 #4
smnoff wrote:
How does one get the source code for memcpy()?


<url:
http://cvs.opensolaris.org/source/xr.../util/memcpy.c
/>

Jun 8 '06 #5
Suman said:
smnoff wrote:
How does one get the source code for memcpy()?


<url:
http://cvs.opensolaris.org/source/xr.../util/memcpy.c
/>


A very portable implementation.

I'd expect machine-specific implementations to box a bit more cleverly,
though - e.g. copying a word at a time rather than a byte as far as
possible, or using dedicated machine instructions where that's relevant.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jun 8 '06 #6
Richard Heathfield wrote:
Suman said:
smnoff wrote:
How does one get the source code for memcpy()?

<url:
http://cvs.opensolaris.org/source/xr.../util/memcpy.c
/>


A very portable implementation.

I'd expect machine-specific implementations to box a bit more cleverly,
though - e.g. copying a word at a time rather than a byte as far as
possible, or using dedicated machine instructions where that's relevant.

Some even check for specific CPU hardware variants, to work around
performance issues with certain instruction sequences. Implementations
for SSE surely will look for aligned runs which can be dealt with by
16-byte loads and stores.
Jun 8 '06 #7
Richard Heathfield wrote:
Suman said:
smnoff wrote:
How does one get the source code for memcpy()?


<url:
http://cvs.opensolaris.org/source/xr.../util/memcpy.c
/>


A very portable implementation.

I'd expect machine-specific implementations to box a bit more cleverly,
though - e.g. copying a word at a time rather than a byte as far as
possible, or using dedicated machine instructions where that's relevant.

<OT?>
<url:
http://cvs.opensolaris.org/source/xr...6/gen/memcpy.s
/>
</OT>

Jun 8 '06 #8
Richard Heathfield wrote:

Suman said:
smnoff wrote:
How does one get the source code for memcpy()?


<url:
http://cvs.opensolaris.org/source/xr.../util/memcpy.c
/>


A very portable implementation.


I think the pointer types should be (unsigned char *) instead.

--
pete
Jun 8 '06 #9
pete said:
Richard Heathfield wrote:

Suman said:
> smnoff wrote:
>> How does one get the source code for memcpy()?
>
> <url:
> http://cvs.opensolaris.org/source/xr.../util/memcpy.c
> />


A very portable implementation.


I think the pointer types should be (unsigned char *) instead.


On reflection, <aol>.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jun 8 '06 #10

"Richard Heathfield" <in*****@invalid.invalid> wrote
Suman said:
smnoff wrote:
How does one get the source code for memcpy()?


<url:
http://cvs.opensolaris.org/source/xr.../util/memcpy.c
/>


A very portable implementation.

Though not strictly conforming.
Arbitrary data must be cast to unsigned char, not plain char.
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm

Jun 9 '06 #11
"smnoff" <rh******@hotmail.com> wrote in message
How does one get the source code for memcpy()?

The string library functions are generally pretty easy to implement with
reasonable efficiency.
memcpy() can be just a bte-copying loop, for instnace.

They are standard library functions for convenience, and because a clever
machine-specific implementation can take advantage of 32-bit copies and the
like. Sometimes the function call might even be inlined by the compiler.
--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $7.20 paper, available www.lulu.com/bgy1mm
Jun 9 '06 #12

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

Similar topics

5
by: Tim Zhao | last post by:
I downloaded the PHP 5 source code from www.php.net web site. It is a tar compressed file. I used WinZip to unzip it. Now I got a whole bunch of files. But I do not know to read these files. Do...
2
by: Fernando Rodriguez | last post by:
Hi, Is ti possible to get the source code of a given function object? O:-) TIA
9
by: Michael Dekson | last post by:
Hello, Can I exe file made in Microsoft Visual C++ decompile into source code. If it is possibly please tell me how. Thanks
22
by: Liang Chen | last post by:
Is the file "bcopy.c" in the "libitery" directory the implement of the GNU C library function "bcopy"? If so, how can it run so fast?(copy-by-byte rather than copy-by-word) When I copy the code of...
135
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about...
7
by: Tina | last post by:
In 1.1 I used to use a WebControlLibrary to hold code I didn't want to expose when I distributed a component. The code would compile to a separate dll and could not be viewed when used in a vs.net...
66
by: Jon Skeet [C# MVP] | last post by:
I'm sure the net will be buzzing with this news fairly soon, but just in case anyone hasn't seen it yet: Microsoft are going to make the source code for the .NET framework (parts of it,...
4
by: Spizzat2 | last post by:
I'm trying to figure out a workaround to a minor annoyance that I'm coming up with while coding a site. I've got some keyboard shortcuts set up for the site via javascript, and when I press escape,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.