LINUX.ORG.RU

Сообщения Edible

 

SVG CSS вложенность

      .tile_empty polygon
      {
        fill:   rgb(255, 255, 255);
        stroke: rgb(  0,   0,   0);
        stroke-width:          1px;
      }
      
      .tile_empty circle
      {
        fill:   rgb(200, 200, 200);
        stroke: rgb(  0,   0,   0);
        stroke-width:          1px;
      }

  <g id = "master_tile">
   <polygon points="-100,-172 100,-172 200,0 100,172 -100,172 -200,0"/> 
   <circle cx="0" cy="0" r="130"/> 
  </g>

  <use id = "master_tile_empty" xlink:href="#master_tile" class = "tile_empty" />

  <use xlink:href="#master_tile_empty" transform="translate(500, 172)"/>

Не работает, css не применяется. Если убрать в css .polygon и .circle то работает, но применяет разумеется сразу к двум элементам. Как сделать им разные свойства?

 ,

Edible
()

Помогите распарсить код

Есть такой код сравнения двух чисел ( > ):

int isGt(int a, int b)
{
    int diff = a ^ b;
    diff |= diff >> 1;
    diff |= diff >> 2;
    diff |= diff >> 4;
    diff |= diff >> 8;
    diff |= diff >> 16;

    //1+ on GT, 0 otherwise.
    diff &= ~(diff >> 1) | 0x80000000;
    diff &= (a ^ 0x80000000) & (b ^ 0x7fffffff);

    //flatten back to range of 0 or 1.
    diff |= diff >> 1;
    diff |= diff >> 2;
    diff |= diff >> 4;
    diff |= diff >> 8;
    diff |= diff >> 16;
    diff &= 1;

    return diff;
}

Не могу распарсить как оно работает. Пробую на 4хбитных числах:

int isGt(int a, int b)
{
#    a = 1100
#    b = 1110
    

    int diff = a ^ b;
    
# diff = 0010    
 
    diff |= diff >> 1;
    
# diff = 0010 | 1 = 0011    
    
    diff |= diff >> 2;
    
# diff = 0011 | 0 = 0011    
    
    diff |= diff >> 4;
    diff |= diff >> 8;
    diff |= diff >> 16;

# diff = 0011

    //1+ on GT, 0 otherwise.
    diff &= ~(diff >> 1) | 0x80000000;
    
# diff = ~(110) | 1000 = 1001 & 0011 = 1
    
    diff &= (a ^ 0x80000000) & (b ^ 0x7fffffff);

# diff = 1100 ^ 1000 = 0100
         1110 ^ 0111 = 1001
         0100 & 1001 = 0
            1 &    0 = 0 // <-- Сломалось, ибо должен быть 1


    //flatten back to range of 0 or 1.
    diff |= diff >> 1;
    diff |= diff >> 2;
    diff |= diff >> 4;
    diff |= diff >> 8;
    diff |= diff >> 16;
    diff &= 1;

    return diff;
}

Как оно работает?

 

Edible
()

RSS подписка на новые темы