/alps/fastwriter

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/fastwriter

« back to all changes in this revision

Viewing changes to fastwriter.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-12-03 21:13:51 UTC
  • mfrom: (12.1.2 fastwriter)
  • Revision ID: csa@dside.dyndns.org-20121203211351-fayu265mie2bop91
Merge custom memcpy

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include <fcntl.h>
17
17
 
18
 
 
19
18
#include "private.h"
20
19
#include "default.h"
21
20
#include "sysinfo.h"
22
21
 
 
22
#ifdef USE_CUSTOM_MEMCPY
 
23
# include "memcpy.h"
 
24
#else /* USE_CUSTOM_MEMCPY */
 
25
# define fast_memcpy memcpy
 
26
#endif /* USE_CUSTOM_MEMCPY */
 
27
 
 
28
 
23
29
fastwriter_t *fastwriter_init(const char *fs, fastwriter_flags_t flags) {
24
30
    fastwriter_t *ctx;
25
31
    
275
281
    if (part1 < size) {
276
282
            // tail < pos (we have checked for free space)
277
283
        end = size - part1;
278
 
        memcpy(ctx->buffer + ctx->pos, data, part1);
279
 
        memcpy(ctx->buffer, data + part1, end);
 
284
        fast_memcpy(ctx->buffer + ctx->pos, data, part1);
 
285
        fast_memcpy(ctx->buffer, data + part1, end);
280
286
        ctx->pos = end;
281
287
    } else {
282
 
        memcpy(ctx->buffer + ctx->pos, data, size);
 
288
        fast_memcpy(ctx->buffer + ctx->pos, data, size);
283
289
        ctx->pos += size;
284
290
        
285
291
        if (ctx->pos == ctx->size) ctx->pos = 0;