Turn Polyglot Affinity into a string option
authorH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 10 Oct 2014 09:07:40 +0000 (11:07 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 10 Oct 2014 12:41:11 +0000 (14:41 +0200)
Now that more than 4 cores/hyper-threads are pretty common, having
to set the mask in decimal, as needed for spin options, can be a real
disaster!

engine.c
option.c

index 5ed6ed7..c1b6862 100644 (file)
--- a/engine.c
+++ b/engine.c
@@ -75,14 +75,14 @@ void engine_close(engine_t * engine){
 // engine_open()
 
 void engine_open(engine_t * engine){
-    int affinity;
+    int affinity= -1;
     pipex_open(engine->pipex,
                "Engine",
                option_get_string(Option,"EngineDir"),
                option_get_string(Option,"EngineCommand"));
     if(pipex_active(engine->pipex)){
             //play with affinity (bad idea)
-        affinity=option_get_int(Option,"Affinity");
+        sscanf(option_get_string(Option,"Affinity"), "%x", &affinity);
         if(affinity!=-1) set_affinity(engine,affinity); //AAA
             // set a low priority
         if (option_get_bool(Option,"UseNice")){
index 3984f0d..5784e1d 100644 (file)
--- a/option.c
+++ b/option.c
@@ -79,7 +79,7 @@ option_t DefaultOptions[] = {
     { "UCIVersion",       "spin","1","2",       "2"         , NULL,0,NNB,  PG|XBOARD}, 
     { "CanPonder",        "check","1","2",      "false"     , NULL,0,NNB,  PG|XBOARD}, 
     { "SyncStop",         "check","1","2",      "false"     , NULL,0,NNB,  PG|XBOARD|XBSEL}, 
-    { "Affinity",         "spin","-1","32",     "-1"        , NULL,0,NNB,  PG|XBOARD}, 
+    { "Affinity",         "spin","0","0",       "FFFFFFFF"  , NULL,0,NNB,  PG|XBOARD}, 
     { "RepeatPV",         "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD},
     { "PromoteWorkAround","check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD},