zoukankan      html  css  js  c++  java
  • signal bit operation

    signal bit operation

     include/linux/signal.h

    #define _SIG_SET_BINOP(name, op) 
    static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) 
    
    { 
    
    unsigned long a0, a1, a2, a3, b0, b1, b2, b3; 
    
    
    
    switch (_NSIG_WORDS) { 
    
    case 4: 
    
    a3 = a->sig[3]; a2 = a->sig[2]; 
    
    b3 = b->sig[3]; b2 = b->sig[2]; 
    
    r->sig[3] = op(a3, b3); 
    
    r->sig[2] = op(a2, b2); 
    
    case 2: 
    
    a1 = a->sig[1]; b1 = b->sig[1]; 
    
    r->sig[1] = op(a1, b1); 
    
    case 1: 
    
    a0 = a->sig[0]; b0 = b->sig[0]; 
    
    r->sig[0] = op(a0, b0); 
    
    break; 
    
    default: 
    
    BUILD_BUG(); 
    
    } 
    
    }
    #define _sig_or(x,y) ((x) | (y))
    
    _SIG_SET_BINOP(sigorsets, _sig_or)
    
    #define _sig_and(x,y) ((x) & (y))
    
    _SIG_SET_BINOP(sigandsets, _sig_and)
    
    #define _sig_andn(x,y) ((x) & ~(y))
    
    _SIG_SET_BINOP(sigandnsets, _sig_andn)

    sigandnsets(d,s1,s2)

    d = s1 & ~s2

  • 相关阅读:
    WindowsForm:百科
    App-应用程式:百科
    ASP.NET:目录
    ASP.NET:百科
    操作平台:.NET
    DB-触发器:百科
    DB-DatabaseLink:百科
    5090 众数
    计数排序
    归并排序
  • 原文地址:https://www.cnblogs.com/aspirs/p/15437832.html
Copyright © 2011-2022 走看看