File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ typedef struct {
5
5
uint32_t column ;
6
6
} Point ;
7
7
8
- Point add_points_in_c (Point a , Point b ) {
9
- if (b . line > 0 ) {
10
- return (Point ) {a . line + b . line , b . column };
8
+ Point add_points_in_c (const Point * a , const Point * b ) {
9
+ if (b -> line > 0 ) {
10
+ return (Point ) {a -> line + b -> line , b -> column };
11
11
} else {
12
- return (Point ) {a . line , a . column + b . column };
12
+ return (Point ) {a -> line , a -> column + b -> column };
13
13
}
14
14
}
Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ pub struct Point {
8
8
}
9
9
10
10
extern "C" {
11
- fn add_points_in_c ( a : Point , b : Point ) -> Point ;
11
+ fn add_points_in_c ( a : * const Point , b : * const Point ) -> Point ;
12
12
}
13
13
14
14
#[ wasm_bindgen]
15
15
pub fn add_points_in_rust ( a : Point , b : Point ) -> Point {
16
- unsafe { add_points_in_c ( a , b ) }
16
+ unsafe { add_points_in_c ( & a as * const Point , & b as * const Point ) }
17
17
}
18
18
19
19
#[ wasm_bindgen]
You can’t perform that action at this time.
0 commit comments