The longest expression I have ever seen

xiaoxiao2021-03-06  70

A method in bitset:

Private static int bitlen (int w) {

// binary search - Decision Tree (5 tests, rarely 6)

Return

(W <1 << 15?

(W <1 << 7?

(W <1 << 3?

(W <1 << 1? (W <1 << 0? (W <0? 32: 0): 1): (W <1 << 2? 2: 3)):

(W <1 << 5? (W <1 << 4? 4: 5): (W <1 << 6? 6: 7)))):

(W <1 << 11?

(W <1 << 9? (W <1 << 8? 8: 9): (W <1 << 10? 10: 11)):

(W <1 << 13? (W <1 << 12? 12: 13): (w <1 << 14? 14: 15))))))):

(W <1 << 23?

(W <1 << 19?

(W <1 << 17? (W <1 << 16? 16: 17): (W <1 << 18? 18: 19)):

(W <1 << 21? (W <1 << 20? 20: 21): (W <1 << 22? 22: 23))):

(W <1 << 27?

(W <1 << 25? (w <1 << 24? 24: 25): (W <1 << 26? 26: 27):

(W <1 << 29? (W <1 << 28? 28: 29): (w <1 << 30? 30: 31)))))))))

}

转载请注明原文地址:https://www.9cbs.com/read-93997.html

New Post(0)