小编Tua*_*ynh的帖子

我是否更喜欢在Swift中使用特定大小的Int(Int8和Int16)?

我正在将项目从Java转换为Swift.我的Java代码使用小数据类型(short,byte).我应该使用Int16,Int8等同于斯威夫特,或者只使用Int类型呢?内存优化和速度在哪里?

types swift

3
推荐指数
1
解决办法
187
查看次数

为什么在swift和java中右移运算符会得到差异结果

我试图将我的代码从java转换为swift,但是当使用Int类型执行shift右运算符时,得到2个diffrence结果.

// java的

int d = 25;
int x = d >> 1 + 1;
System.out.println(x); //output: 6
Run Code Online (Sandbox Code Playgroud)

// swift(4)

 let d = 25
 let x = d >> 1 + 1
 print(x)  //output: 13
Run Code Online (Sandbox Code Playgroud)

什么是快速代码的解决方案?

java swift

3
推荐指数
1
解决办法
110
查看次数

标签 统计

swift ×2

java ×1

types ×1