/[pcre]/code/trunk/pcre_byte_order.c
ViewVC logotype

Diff of /code/trunk/pcre_byte_order.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 85 by nigel, Sat Feb 24 21:41:13 2007 UTC revision 230 by ph10, Mon Sep 10 13:23:56 2007 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2005 University of Cambridge             Copyright (c) 1997-2007 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 43  see if it was compiled with the opposite Line 43  see if it was compiled with the opposite
43  auxiliary local function to flip the appropriate bytes. */  auxiliary local function to flip the appropriate bytes. */
44    
45    
46    #ifdef HAVE_CONFIG_H
47    #include <config.h>
48    #endif
49    
50  #include "pcre_internal.h"  #include "pcre_internal.h"
51    
52    
# Line 62  Arguments: Line 66  Arguments:
66  Returns:       the flipped value  Returns:       the flipped value
67  */  */
68    
69  static long int  static unsigned long int
70  byteflip(long int value, int n)  byteflip(unsigned long int value, int n)
71  {  {
72  if (n == 2) return ((value & 0x00ff) << 8) | ((value & 0xff00) >> 8);  if (n == 2) return ((value & 0x00ff) << 8) | ((value & 0xff00) >> 8);
73  return ((value & 0x000000ff) << 24) |  return ((value & 0x000000ff) << 24) |
# Line 94  Returns:           the new block if is i Line 98  Returns:           the new block if is i
98                     NULL if it is not                     NULL if it is not
99  */  */
100    
101  PCRE_EXPORT real_pcre *  real_pcre *
102  _pcre_try_flipped(const real_pcre *re, real_pcre *internal_re,  _pcre_try_flipped(const real_pcre *re, real_pcre *internal_re,
103    const pcre_study_data *study, pcre_study_data *internal_study)    const pcre_study_data *study, pcre_study_data *internal_study)
104  {  {
# Line 104  if (byteflip(re->magic_number, sizeof(re Line 108  if (byteflip(re->magic_number, sizeof(re
108  *internal_re = *re;           /* To copy other fields */  *internal_re = *re;           /* To copy other fields */
109  internal_re->size = byteflip(re->size, sizeof(re->size));  internal_re->size = byteflip(re->size, sizeof(re->size));
110  internal_re->options = byteflip(re->options, sizeof(re->options));  internal_re->options = byteflip(re->options, sizeof(re->options));
111    internal_re->flags = (pcre_uint16)byteflip(re->flags, sizeof(re->flags));
112  internal_re->top_bracket =  internal_re->top_bracket =
113    (pcre_uint16)byteflip(re->top_bracket, sizeof(re->top_bracket));    (pcre_uint16)byteflip(re->top_bracket, sizeof(re->top_bracket));
114  internal_re->top_backref =  internal_re->top_backref =

Legend:
Removed from v.85  
changed lines
  Added in v.230

  ViewVC Help
Powered by ViewVC 1.1.5