mirror of
https://github.com/servo/servo.git
synced 2025-07-29 10:10:34 +01:00
Remove the `ucd` dependency which has not been updated in 8 years. In addition, replace it with a generated UnicodeBlock enum which reflects the modern Unicode standard. This is generated via a Python script which is included in the repository. The generation is not part of the build process, because the Unicode database is hosted on the web and it does not change the frequently. This is done instead of bringing in the more up-to-date `unicode_blocks` dependency. `unicode_blocks` defines each block as constant, which means that they cannot be used in match statements -- which we do in Servo. Co-authored-by: Lauryn Menard <lauryn.menard@gmail.com>
11 lines
411 B
Rust
11 lines
411 B
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
pub fn float_to_fixed(before: usize, f: f64) -> i32 {
|
|
((1i32 << before) as f64 * f) as i32
|
|
}
|
|
|
|
pub fn fixed_to_float(before: usize, f: i32) -> f64 {
|
|
f as f64 * 1.0f64 / ((1i32 << before) as f64)
|
|
}
|