~ubuntu-branches/debian/squeeze/ffcall/squeeze

« back to all changes in this revision

Viewing changes to callback/vacall_r/structcpy.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2010-06-26 15:29:30 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626152930-c09y01gk3szcnykn
Tags: 1.10+cvs20100619-2
Ship to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* copy structs */
 
2
 
 
3
/*
 
4
 * Copyright 1995-1999, 2005 Bruno Haible, <bruno@clisp.org>
 
5
 *
 
6
 * This is free software distributed under the GNU General Public Licence
 
7
 * described in the file COPYING. Contact the author if you don't have this
 
8
 * or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied,
 
9
 * on this software.
 
10
 */
 
11
 
 
12
void __structcpy (void* dest, const void* src, unsigned long size, unsigned long alignment)
 
13
{
 
14
  if (alignment % sizeof(long))
 
15
    { char* d = (char*)dest;
 
16
      const char* s = (const char*)src;
 
17
      do { *d++ = *s++; } while (--size > 0);
 
18
    }
 
19
  else
 
20
    /* If the alignment is a multiple of sizeof(long), the size is as well. */
 
21
    { long* d = (long*)dest;
 
22
      const long* s = (const long*)src;
 
23
      do { *d++ = *s++; } while ((size -= sizeof(long)) > 0);
 
24
    }
 
25
}