__sync_fetch_and_add的含义

来源:互联网 发布:银联数据是国企吗 编辑:程序博客网 时间:2024/05/18 22:13
type __sync_fetch_and_add (type *ptr, type value, ...)type __sync_fetch_and_sub (type *ptr, type value, ...)type __sync_fetch_and_or (type *ptr, type value, ...)type __sync_fetch_and_and (type *ptr, type value, ...)type __sync_fetch_and_xor (type *ptr, type value, ...)type __sync_fetch_and_nand (type *ptr, type value, ...)These builtins perform the operation suggested by the name, and returns the value that had previously been in memory. That is,          { tmp = *ptr; *ptr op= value; return tmp; }          { tmp = *ptr; *ptr = ~tmp & value; return tmp; }   // nand//总结就是先进行操作,然后返回之前的值type __sync_add_and_fetch (type *ptr, type value, ...)type __sync_sub_and_fetch (type *ptr, type value, ...)type __sync_or_and_fetch (type *ptr, type value, ...)type __sync_and_and_fetch (type *ptr, type value, ...)type __sync_xor_and_fetch (type *ptr, type value, ...)type __sync_nand_and_fetch (type *ptr, type value, ...)These builtins perform the operation suggested by the name, and return the new value. That is,          { *ptr op= value; return *ptr; }          { *ptr = ~*ptr & value; return *ptr; }   // nand//总结就是先进行操作,然后返回操作之后的值
原创粉丝点击