gpt4 book ai didi

c - iOS 中的按位或

转载 作者:太空宇宙 更新时间:2023-11-04 01:40:15 24 4
gpt4 key购买 nike

enum {
UIViewAnimationOptionLayoutSubviews = 1 << 0,
UIViewAnimationOptionAllowUserInteraction = 1 << 1,
UIViewAnimationOptionBeginFromCurrentState = 1 << 2,
UIViewAnimationOptionRepeat = 1 << 3,
UIViewAnimationOptionAutoreverse = 1 << 4,
UIViewAnimationOptionOverrideInheritedDuration = 1 << 5,
UIViewAnimationOptionOverrideInheritedCurve = 1 << 6,
UIViewAnimationOptionAllowAnimatedContent = 1 << 7,
UIViewAnimationOptionShowHideTransitionViews = 1 << 8,

UIViewAnimationOptionCurveEaseInOut = 0 << 16,
UIViewAnimationOptionCurveEaseIn = 1 << 16,
UIViewAnimationOptionCurveEaseOut = 2 << 16,
UIViewAnimationOptionCurveLinear = 3 << 16,

UIViewAnimationOptionTransitionNone = 0 << 20,
UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20,
UIViewAnimationOptionTransitionFlipFromRight = 2 << 20,
UIViewAnimationOptionTransitionCurlUp = 3 << 20,
UIViewAnimationOptionTransitionCurlDown = 4 << 20,
};
typedef NSUInteger UIViewAnimationOptions;

这个表达式的确切含义:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse.

UIViewAnimationOptionRepeat 的值等于 8(在 bin 1000 中),UIViewAnimationOptionAutoreverse 等于 16(在 bin 10000 中)。所以表达式 UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse 应该按照我的想法生成 16(bin 10000) -> UIViewAnimationOptionReverse。

最佳答案

操作|由真值表定义

   | 0 | 1  
---+---+---
0 | 0 | 1
1 | 1 | 1

x | y == 0 仅当 x == 0y == 0 时。 | 运算符同时作用于机器字的所有位。所以

  001000   (8)
| 010000 (16)
------------
011000 (24)

关于c - iOS 中的按位或,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6558600/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com