-
Notifications
You must be signed in to change notification settings - Fork 292
Reduce amount of deprecation warnings when compiling xapi #3570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a293c83
7df0d1b
2f7a78b
7dfdae5
932b532
a307d12
169dc48
97d157b
f1f4e29
50552d5
2cfb3f0
ff8bf75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,29 +51,23 @@ module Marshal = struct | |
and f = (x >>> 40) &&& 0xffL | ||
and g = (x >>> 48) &&& 0xffL | ||
and h = (x >>> 56) &&& 0xffL in | ||
let result = String.make 8 '\000' in | ||
result.[0] <- char_of_int (Int64.to_int a); | ||
result.[1] <- char_of_int (Int64.to_int b); | ||
result.[2] <- char_of_int (Int64.to_int c); | ||
result.[3] <- char_of_int (Int64.to_int d); | ||
result.[4] <- char_of_int (Int64.to_int e); | ||
result.[5] <- char_of_int (Int64.to_int f); | ||
result.[6] <- char_of_int (Int64.to_int g); | ||
result.[7] <- char_of_int (Int64.to_int h); | ||
result | ||
let result = Bytes.make 8 '\000' in | ||
List.iteri (fun i v -> | ||
Bytes.set result i (char_of_int @@ Int64.to_int v) | ||
) [a; b; c; d; e; f; g; h]; | ||
Bytes.unsafe_to_string result | ||
let int32 x = | ||
let (>>>) a b = Int32.shift_right_logical a b | ||
and (&&&) a b = Int32.logand a b in | ||
let a = (x >>> 0) &&& 0xffl | ||
and b = (x >>> 8) &&& 0xffl | ||
and c = (x >>> 16) &&& 0xffl | ||
and d = (x >>> 24) &&& 0xffl in | ||
let result = String.make 4 '\000' in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you're ANDing them all with the same value, why not include that in the definition of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would find that confusing, because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With a different operator of course There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case I think it's better to keep the old code and stick to operators that look like the usual ones |
||
result.[0] <- char_of_int (Int32.to_int a); | ||
result.[1] <- char_of_int (Int32.to_int b); | ||
result.[2] <- char_of_int (Int32.to_int c); | ||
result.[3] <- char_of_int (Int32.to_int d); | ||
result | ||
let result = Bytes.make 4 '\000' in | ||
List.iteri (fun i v -> | ||
Bytes.set result i (char_of_int @@ Int32.to_int v) | ||
) [a; b; c; d]; | ||
Bytes.unsafe_to_string result | ||
|
||
end | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could replace this with
Astring.String.map
or something similar - performance probably doesn't matter in the autogenerator:http://erratique.ch/software/astring/doc/Astring.String.html