OpenSDE Packages Database (without history before r20070)
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.

106 lines
3.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../gnubg/gcc4.patch
  5. # Copyright (C) 2008 The OpenSDE Project
  6. # Copyright (C) 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This patch file is dual-licensed. It is available under the license the
  11. # patched project is licensed under, as long as it is an OpenSource license
  12. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  13. # of the GNU General Public License as published by the Free Software
  14. # Foundation; either version 2 of the License, or (at your option) any later
  15. # version.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. diff -Nur gnubg-0.14.3-orig/eval.c gnubg-0.14.3/eval.c
  18. --- gnubg-0.14.3-orig/eval.c 2004-05-07 05:20:21.000000000 +0000
  19. +++ gnubg-0.14.3/eval.c 2006-01-26 13:30:59.383449250 +0000
  20. @@ -798,7 +798,10 @@
  21. if( !fstat( h, &st ) &&
  22. ( p = mmap( NULL, st.st_size, PROT_READ | PROT_WRITE,
  23. MAP_PRIVATE, h, 0 ) ) ) {
  24. - ( (float *) p ) += 2; /* skip magic number and version */
  25. +// ( (float *) p ) += 2; /* skip magic number and version */
  26. + float *pf = p;
  27. + p += 2;
  28. + p = pf;
  29. fReadWeights =
  30. ( p = NeuralNetCreateDirect( &nnContact, p ) ) &&
  31. ( p = NeuralNetCreateDirect( &nnRace, p ) ) &&
  32. diff -Nur gnubg-0.14.3-orig/lib/neuralnet.c gnubg-0.14.3/lib/neuralnet.c
  33. --- gnubg-0.14.3-orig/lib/neuralnet.c 2004-02-24 10:15:50.000000000 +0000
  34. +++ gnubg-0.14.3/lib/neuralnet.c 2006-01-26 13:24:02.577400500 +0000
  35. @@ -386,13 +386,23 @@
  36. }
  37. extern void *NeuralNetCreateDirect( neuralnet *pnn, void *p ) {
  38. - pnn->cInput = *( ( (int *) p )++ );
  39. - pnn->cHidden = *( ( (int *) p )++ );
  40. - pnn->cOutput = *( ( (int *) p )++ );
  41. - pnn->nTrained = *( ( (int *) p )++ );
  42. + float *fp;
  43. + int *ip = ( int *)p;
  44. +
  45. + pnn->cInput = *ip;
  46. + ip++;
  47. + pnn->cHidden = *ip;
  48. + ip++;
  49. + pnn->cOutput = *ip;
  50. + ip++;
  51. + pnn->nTrained = *ip;
  52. + ip++;
  53. pnn->fDirect = TRUE;
  54. - pnn->rBetaHidden = *( ( (float *) p )++ );
  55. - pnn->rBetaOutput = *( ( (float *) p )++ );
  56. + fp = (float*)ip;
  57. + pnn->rBetaHidden = *fp;
  58. + fp++;
  59. + pnn->rBetaOutput = *fp;
  60. + fp++;
  61. if( pnn->cInput < 1 || pnn->cHidden < 1 || pnn->cOutput < 1 ||
  62. pnn->nTrained < 0 || pnn->rBetaHidden <= 0.0 ||
  63. @@ -402,19 +412,19 @@
  64. return NULL;
  65. }
  66. - pnn->arHiddenWeight = p;
  67. - ( (float *) p ) += pnn->cInput * pnn->cHidden;
  68. - pnn->arOutputWeight = p;
  69. - ( (float *) p ) += pnn->cHidden * pnn->cOutput;
  70. - pnn->arHiddenThreshold = p;
  71. - ( (float *) p ) += pnn->cHidden;
  72. - pnn->arOutputThreshold = p;
  73. - ( (float *) p ) += pnn->cOutput;
  74. + pnn->arHiddenWeight = fp;
  75. + fp += pnn->cInput * pnn->cHidden;
  76. + pnn->arOutputWeight = fp;
  77. + fp += pnn->cHidden * pnn->cOutput;
  78. + pnn->arHiddenThreshold = fp;
  79. + fp += pnn->cHidden;
  80. + pnn->arOutputThreshold = fp;
  81. + fp += pnn->cOutput;
  82. pnn->savedBase = malloc( pnn->cHidden * sizeof( float ) );
  83. pnn->savedIBase = malloc( pnn->cInput * sizeof( float ) );
  84. - return p;
  85. + return fp;
  86. }
  87. extern int
  88. diff -Nur gnubg-0.14.3-orig/rollout.c gnubg-0.14.3/rollout.c
  89. --- gnubg-0.14.3-orig/rollout.c 2004-05-07 05:20:21.000000000 +0000
  90. +++ gnubg-0.14.3/rollout.c 2006-01-26 13:32:38.445640250 +0000
  91. @@ -219,7 +219,7 @@
  92. nPermutationSeed = n;
  93. }
  94. -static int nSkip;
  95. +int nSkip;
  96. static int RolloutDice( int iTurn, int iGame, int cGames,
  97. int fInitial,