Skip to content

Commit

Permalink
reformat source file
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Nov 11, 2018
1 parent 0589462 commit dde93a5
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 86 deletions.
87 changes: 46 additions & 41 deletions bld/clib/search/c/qsortr_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ typedef int WORD;

void inline_swap( char *p, char *q, size_t size );
#pragma aux inline_swap = \
"push es" \
"push ds" \
"pop es" \
"movzx edx,cl" \
"shr ecx,2" \
"push es" \
"push ds" \
"pop es" \
"movzx edx,cl" \
"shr ecx,2" \
"je short L1" \
"L2: mov eax,[edi]" \
"xchg eax,[esi]" \
"L2: mov eax,[edi]" \
"xchg eax,[esi]" \
"stosd" \
"add esi,4" \
"dec ecx" \
"add esi,4" \
"dec ecx" \
"jne short L2" \
"L1: and dl,3" \
"L1: and dl,3" \
"je short L3" \
"L4: mov al,[edi]" \
"xchg al,[esi]" \
"L4: mov al,[edi]" \
"xchg al,[esi]" \
"stosb" \
"inc esi" \
"dec edx" \
"inc esi" \
"dec edx" \
"jne short L4" \
"L3: pop es" \
"L3: pop es" \
AUX_INFO

#pragma aux byteswap AUX_INFO
Expand All @@ -100,22 +100,22 @@ typedef int WORD;

void inline_swap( char _WCFAR *p, char _WCFAR *q, size_t size );
#pragma aux inline_swap = \
"push ds" \
"mov ds,dx" \
"shr cx,1" \
"push ds" \
"mov ds,dx" \
"shr cx,1" \
"je short L1" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"stosw" \
"inc si" \
"inc si" \
"dec cx" \
"inc si" \
"inc si" \
"dec cx" \
"jne short L2" \
"L1: jnc short L3" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"L3: pop ds" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"L3: pop ds" \
AUX_INFO

#pragma aux byteswap AUX_INFO
Expand All @@ -133,19 +133,19 @@ typedef int WORD;

void inline_swap( char *p, char _WCFAR *q, size_t size );
#pragma aux inline_swap = \
"shr cx,1" \
"shr cx,1" \
"je short L1" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"stosw" \
"inc si" \
"inc si" \
"dec cx" \
"inc si" \
"inc si" \
"dec cx" \
"jne short L2" \
"L1: jnc short L3" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"L3:" \
AUX_INFO

Expand All @@ -158,7 +158,8 @@ typedef int WORD;
#else
/* this is an optimized version of a simple byteswap */
#define inline_swap BYTESWAP
static void _WCNEAR BYTESWAP( PTRATTR char *p, PTRATTR char *q, size_t size ) {
static void _WCNEAR BYTESWAP( PTRATTR char *p, PTRATTR char *q, size_t size )
{
long dword;
short word;
char byte;
Expand Down Expand Up @@ -328,11 +329,13 @@ FUNCTION_LINKAGE errno_t FUNCTION_NAME(
pc -= size;
count--;
}
if( !count ) break;
if( count == 0 )
break;
swap( pb, pc );
pb += size;
count--;
if( !count ) break;
if( count == 0 )
break;
pc -= size;
count--;
}
Expand All @@ -356,7 +359,8 @@ FUNCTION_LINKAGE errno_t FUNCTION_NAME(
n = r / size; /* Set up n for next 'call' */
/* next base is still base */
} else {
if( r <= size ) break;
if( r <= size )
break;
base_stack[sp] = base; /* Stack up base */
n_stack[sp] = r / size; /* Stack up n */
base = pn - s; /* Set up base and n for */
Expand All @@ -365,7 +369,8 @@ FUNCTION_LINKAGE errno_t FUNCTION_NAME(
++sp;
}
}
if( sp == 0 ) break;
if( sp == 0 )
break;
--sp;
base = base_stack[sp];
n = n_stack[sp];
Expand Down
94 changes: 49 additions & 45 deletions bld/clib/search/c/qsortrtn.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,27 @@ typedef int WORD;

void inline_swap( char *p, char *q, size_t size );
#pragma aux inline_swap = \
"push es" \
"push ds" \
"pop es" \
"movzx edx,cl" \
"shr ecx,2" \
"push es" \
"push ds" \
"pop es" \
"movzx edx,cl" \
"shr ecx,2" \
"je short L1" \
"L2: mov eax,[edi]" \
"xchg eax,[esi]" \
"L2: mov eax,[edi]" \
"xchg eax,[esi]" \
"stosd" \
"add esi,4" \
"dec ecx" \
"add esi,4" \
"dec ecx" \
"jne short L2" \
"L1: and dl,3" \
"L1: and dl,3" \
"je short L3" \
"L4: mov al,[edi]" \
"xchg al,[esi]" \
"L4: mov al,[edi]" \
"xchg al,[esi]" \
"stosb" \
"inc esi" \
"dec edx" \
"inc esi" \
"dec edx" \
"jne short L4" \
"L3: pop es" \
"L3: pop es" \
AUX_INFO

#pragma aux byteswap AUX_INFO
Expand All @@ -104,23 +104,23 @@ typedef int WORD;
modify exact [ax cx di si]

void inline_swap( char _WCFAR *p, char _WCFAR *q, size_t size );
#pragma aux inline_swap = \
"push ds" \
"mov ds,dx" \
"shr cx,1" \
"je short L1" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"stosw" \
"inc si" \
"inc si" \
"dec cx" \
"jne short L2" \
"L1: jnc short L3" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"L3: pop ds" \
#pragma aux inline_swap = \
"push ds" \
"mov ds,dx" \
"shr cx,1" \
"je short L1" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"stosw" \
"inc si" \
"inc si" \
"dec cx" \
"jne short L2" \
"L1: jnc short L3" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"L3: pop ds" \
AUX_INFO

#pragma aux byteswap AUX_INFO
Expand All @@ -138,19 +138,19 @@ typedef int WORD;

void inline_swap( char *p, char _WCFAR *q, size_t size );
#pragma aux inline_swap = \
"shr cx,1" \
"shr cx,1" \
"je short L1" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"L2: mov ax,es:[di]" \
"xchg ax,[si]" \
"stosw" \
"inc si" \
"inc si" \
"dec cx" \
"inc si" \
"inc si" \
"dec cx" \
"jne short L2" \
"L1: jnc short L3" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"mov al,[si]" \
"xchg al,es:[di]" \
"mov [si],al" \
"L3:" \
AUX_INFO

Expand Down Expand Up @@ -319,11 +319,13 @@ FUNCTION_LINKAGE void FUNCTION_NAME(
pc -= size;
count--;
}
if( !count ) break;
if( count == 0 )
break;
swap( pb, pc );
pb += size;
count--;
if( !count ) break;
if( count == 0 )
break;
pc -= size;
count--;
}
Expand All @@ -347,7 +349,8 @@ FUNCTION_LINKAGE void FUNCTION_NAME(
n = r / size; /* Set up n for next 'call'*/
/* next base is still base */
} else {
if( r <= size ) break;
if( r <= size )
break;
base_stack[sp] = base; /* Stack up base */
n_stack[sp] = r / size; /* Stack up n */
base = pn - s; /* Set up base and n for */
Expand All @@ -356,7 +359,8 @@ FUNCTION_LINKAGE void FUNCTION_NAME(
++sp;
}
}
if( sp == 0 ) break;
if( sp == 0 )
break;
--sp;
base = base_stack[sp];
n = n_stack[sp];
Expand Down

0 comments on commit dde93a5

Please sign in to comment.