qiniu / ruby-sdk

Qiniu Resource (Cloud) Storage SDK for Ruby
MIT License
164 stars 138 forks source link

UP._block_count #30

Closed zhouguangming closed 11 years ago

zhouguangming commented 11 years ago
def _block_count(fsize)
   (fsize + Config.settings[:block_size] - 1) / Config.settings[:block_size]).to_i
end

为什么要减1?

xushiwei commented 11 years ago

这是正常的 round 算法。不过这里感觉应该赋值一个中间变量,以提升执行效率和可读性。