Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dotnet] Add op sigs for a few more ops.
  • Loading branch information
jnthn committed Jan 22, 2011
1 parent 3b6c0e6 commit 30430d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions dotnet/compiler/PAST2DNSTCompiler.pm
Expand Up @@ -13,6 +13,11 @@ INIT {
%nqp_op_sigs<equal_ints> := ('int', 'int', 'int');
%nqp_op_sigs<equal_strs> := ('int', 'str', 'str');
%nqp_op_sigs<logical_not_int> := ('int', 'int');
%nqp_op_sigs<add_int> := ('int', 'int', 'int');
%nqp_op_sigs<sub_int> := ('int', 'int', 'int');
%nqp_op_sigs<mul_int> := ('int', 'int', 'int');
%nqp_op_sigs<div_int> := ('int', 'int', 'int');
%nqp_op_sigs<mod_int> := ('int', 'int', 'int');
}

# Entry point for the compiler.
Expand Down
20 changes: 10 additions & 10 deletions dotnet/runtime/Runtime/Ops/Primitive.cs
Expand Up @@ -32,9 +32,9 @@ public static int logical_not_int(ThreadContext TC, int x)
/// <param name="y"></param>
/// <param name="ResultType"></param>
/// <returns></returns>
public static RakudoObject add_int(ThreadContext TC, RakudoObject x, RakudoObject y)
public static int add_int(ThreadContext TC, int x, int y)
{
return Ops.box_int(TC, Ops.unbox_int(TC, x) + Ops.unbox_int(TC, y), TC.DefaultIntBoxType);
return x + y;
}

/// <summary>
Expand All @@ -44,9 +44,9 @@ public static RakudoObject add_int(ThreadContext TC, RakudoObject x, RakudoObjec
/// <param name="y"></param>
/// <param name="ResultType"></param>
/// <returns></returns>
public static RakudoObject sub_int(ThreadContext TC, RakudoObject x, RakudoObject y)
public static int sub_int(ThreadContext TC, int x, int y)
{
return Ops.box_int(TC, Ops.unbox_int(TC, x) - Ops.unbox_int(TC, y), TC.DefaultIntBoxType);
return x - y;
}

/// <summary>
Expand All @@ -56,9 +56,9 @@ public static RakudoObject sub_int(ThreadContext TC, RakudoObject x, RakudoObjec
/// <param name="y"></param>
/// <param name="ResultType"></param>
/// <returns></returns>
public static RakudoObject mul_int(ThreadContext TC, RakudoObject x, RakudoObject y)
public static int mul_int(ThreadContext TC, int x, int y)
{
return Ops.box_int(TC, Ops.unbox_int(TC, x) * Ops.unbox_int(TC, y), TC.DefaultIntBoxType);
return x * y;
}

/// <summary>
Expand All @@ -68,9 +68,9 @@ public static RakudoObject mul_int(ThreadContext TC, RakudoObject x, RakudoObjec
/// <param name="y"></param>
/// <param name="ResultType"></param>
/// <returns></returns>
public static RakudoObject div_int(ThreadContext TC, RakudoObject x, RakudoObject y)
public static int div_int(ThreadContext TC, int x, int y)
{
return Ops.box_int(TC, Ops.unbox_int(TC, x) / Ops.unbox_int(TC, y), TC.DefaultIntBoxType);
return x / y;
}

/// <summary>
Expand All @@ -80,9 +80,9 @@ public static RakudoObject div_int(ThreadContext TC, RakudoObject x, RakudoObjec
/// <param name="y"></param>
/// <param name="ResultType"></param>
/// <returns></returns>
public static RakudoObject mod_int(ThreadContext TC, RakudoObject x, RakudoObject y)
public static int mod_int(ThreadContext TC, int x, int y)
{
return Ops.box_int(TC, Ops.unbox_int(TC, x) % Ops.unbox_int(TC, y), TC.DefaultIntBoxType);
return x % y;
}

/// <summary>
Expand Down

0 comments on commit 30430d2

Please sign in to comment.