gpt4 book ai didi

java - DSCP 优先级

转载 作者:行者123 更新时间:2023-12-01 12:06:30 28 4
gpt4 key购买 nike

如何使用 Java 获取 DiffServe 代码点 (DSCP) 整数的优先级部分?我预计它涉及位移位,但由于某种原因,我似乎无法获得我期望的值。

最佳答案

假设我理解正确,只需向右执行 3 位逻辑移位:

dscp >>> 3

像这样:

for (int dscp = 0; dscp < 57; dscp++) {
System.out.println("DSCP:" + dscp + " Precedence:" + (dscp >>> 3));
}

输出:

DSCP:0 Precedence:0
DSCP:1 Precedence:0
DSCP:2 Precedence:0
DSCP:3 Precedence:0
DSCP:4 Precedence:0
DSCP:5 Precedence:0
DSCP:6 Precedence:0
DSCP:7 Precedence:0
DSCP:8 Precedence:1
DSCP:9 Precedence:1
DSCP:10 Precedence:1
DSCP:11 Precedence:1
DSCP:12 Precedence:1
DSCP:13 Precedence:1
DSCP:14 Precedence:1
DSCP:15 Precedence:1
DSCP:16 Precedence:2
DSCP:17 Precedence:2
DSCP:18 Precedence:2
DSCP:19 Precedence:2
DSCP:20 Precedence:2
DSCP:21 Precedence:2
DSCP:22 Precedence:2
DSCP:23 Precedence:2
DSCP:24 Precedence:3
DSCP:25 Precedence:3
DSCP:26 Precedence:3
DSCP:27 Precedence:3
DSCP:28 Precedence:3
DSCP:29 Precedence:3
DSCP:30 Precedence:3
DSCP:31 Precedence:3
DSCP:32 Precedence:4
DSCP:33 Precedence:4
DSCP:34 Precedence:4
DSCP:35 Precedence:4
DSCP:36 Precedence:4
DSCP:37 Precedence:4
DSCP:38 Precedence:4
DSCP:39 Precedence:4
DSCP:40 Precedence:5
DSCP:41 Precedence:5
DSCP:42 Precedence:5
DSCP:43 Precedence:5
DSCP:44 Precedence:5
DSCP:45 Precedence:5
DSCP:46 Precedence:5
DSCP:47 Precedence:5
DSCP:48 Precedence:6
DSCP:49 Precedence:6
DSCP:50 Precedence:6
DSCP:51 Precedence:6
DSCP:52 Precedence:6
DSCP:53 Precedence:6
DSCP:54 Precedence:6
DSCP:55 Precedence:6
DSCP:56 Precedence:7

关于java - DSCP 优先级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27551980/

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