Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.4 KiB

  1. /**************************************************************************
  2. * *
  3. * Copyright (C) 1992, Silicon Graphics, Inc. *
  4. * *
  5. * These coded instructions, statements, and computer programs contain *
  6. * unpublished proprietary information of Silicon Graphics, Inc., and *
  7. * are protected by Federal copyright law. They may not be disclosed *
  8. * to third parties or copied or duplicated in any form, in whole or *
  9. * in part, without the prior written consent of Silicon Graphics, Inc. *
  10. * *
  11. **************************************************************************/
  12. /*
  13. * flistsorter.c++ - $Revision: 1.1 $
  14. * Derrick Burns - 1991
  15. */
  16. #include "glimport.h"
  17. #include "flistsor.h"
  18. FlistSorter::FlistSorter( void ) : Sorter( sizeof( REAL ) )
  19. {
  20. }
  21. void
  22. FlistSorter::qsort( REAL *p, int n )
  23. {
  24. Sorter::qsort( (char *)p, n );
  25. }
  26. int
  27. FlistSorter::qscmp( char *i, char *j )
  28. {
  29. REAL f0 = *(REAL *)i;
  30. REAL f1 = *(REAL *)j;
  31. return (f0 < f1) ? -1 : 1;
  32. }
  33. void
  34. FlistSorter::qsexc( char *i, char *j )
  35. {
  36. REAL *f0 = (REAL *)i;
  37. REAL *f1 = (REAL *)j;
  38. REAL tmp = *f0;
  39. *f0 = *f1;
  40. *f1 = tmp;
  41. }
  42. void
  43. FlistSorter::qstexc( char *i, char *j, char *k )
  44. {
  45. REAL *f0 = (REAL *)i;
  46. REAL *f1 = (REAL *)j;
  47. REAL *f2 = (REAL *)k;
  48. REAL tmp = *f0;
  49. *f0 = *f2;
  50. *f2 = *f1;
  51. *f1 = tmp;
  52. }