Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F42726188
test7.c
hselasky (Hans Petter Selasky)
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
•
hselasky
Jun 2 2022, 6:39 PM
2022-06-02 18:39:49 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
test7.c
View Options
#include
<stdio.h>
#include
<stdint.h>
typedef
uint8_t
tcp_seq
;
#define SEQ_LT(a,b) ((int8_t)((a) - (b)) < 0)
#ifdef SIMULATE_32BIT_LONG
static
uint8_t
ulmin
(
uint8_t
a
,
uint8_t
b
)
{
return
(
a
<
b
?
a
:
b
);
}
#else
static
uint16_t
ulmin
(
uint16_t
a
,
uint16_t
b
)
{
return
(
a
<
b
?
a
:
b
);
}
#endif
int
main
()
{
int
x
,
y
;
static
int
last_y
=
-1
;
static
int
last_x
=
-1
;
for
(
x
=
0
;
x
!=
256
;
x
++
)
{
int
num
=
0
;
for
(
y
=
0
;
y
!=
256
;
y
++
)
{
if
(
SEQ_LT
(
x
,
y
))
{
if
(
last_x
!=
x
)
{
if
(
last_y
>
-1
)
printf
(
"%d
\n
"
,
(
uint8_t
)
last_y
);
printf
(
"LT(%d, [%d ... "
,
(
uint8_t
)
x
,
(
uint8_t
)
y
);
last_x
=
x
;
last_y
=
y
-
1
;
int
len
=
(
int16_t
)
ulmin
(
16
,
(
uint8_t
)
y
-
(
uint8_t
)
x
);
printf
(
"L=%d "
,
len
);
}
if
(
last_y
+
1
!=
y
)
{
int
len
=
(
int16_t
)
ulmin
(
16
,
(
uint8_t
)
last_y
-
(
uint8_t
)
x
);
printf
(
"L=%d "
,
len
);
printf
(
"%d] | [%d ... "
,
(
uint8_t
)
last_y
,
y
);
len
=
(
int16_t
)
ulmin
(
16
,
(
uint8_t
)
y
-
(
uint8_t
)
x
);
printf
(
"L=%d "
,
len
);
}
last_y
=
y
;
num
++
;
}
}
int
len
=
(
int16_t
)
ulmin
(
16
,
(
uint8_t
)
last_y
-
(
uint8_t
)
x
);
printf
(
"L=%d "
,
len
);
printf
(
"%d] # %d
\n
"
,
(
uint8_t
)
last_y
,
num
);
last_y
=
-1
;
}
return
(
0
);
}
File Metadata
Details
Attached
Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4812357
Default Alt Text
test7.c (1 KB)
Attached To
Mode
D35388: tcp: Correctly compute the retransmit length for all 64-bit platforms.
Attached
Detach File
Event Timeline
Log In to Comment