波浪号在表达式中是什么意思? [英] What does the tilde mean in an expression?

查看:23
本文介绍了波浪号在表达式中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<块引用>

可能的重复:
C# 枚举中的波浪号 (~) 是什么?

我在 this MSDN 页面.

(((Width * Planes * BitCount + 31) & ~31)/8) * abs(Height)

这确实可以在 C# Visual Studio 2010 中编译.数字 31 前面的波浪号~"到底是做什么的?我以前从未在表达式中看到过这种语法.

解决方案

这就是 按位补码

a> 运算符,也称为按位求反.

Possible Duplicate:
What is the tilde (~) in a C# enumeration?

I found the following bit of code on a this MSDN page.

(((Width * Planes * BitCount + 31) & ~31) / 8) * abs(Height)

This does indeed compile in C# visual studio 2010. What exactly is the tilde "~" doing in front of the number 31? I've never seen this syntax in an expression before.

解决方案

That is the bitwise complement operator, also known as bitwise negation.

这篇关于波浪号在表达式中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆