mirror of
https://github.com/golang/go.git
synced 2025-05-28 02:41:30 +00:00
Add missing function prototypes. Fix function prototypes. Use FP references instead of SP references. Fix variable names. Update comments. Clean up whitespace. (Not for vet.) All fairly minor fixes to make vet happy. Updates #11041 Change-Id: Ifab2cdf235ff61cdc226ab1d84b8467b5ac9446c Reviewed-on: https://go-review.googlesource.com/27713 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
35 lines
1.1 KiB
ArmAsm
35 lines
1.1 KiB
ArmAsm
// Copyright 2010 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
#include "textflag.h"
|
|
|
|
// func Modf(f float64) (int float64, frac float64)
|
|
TEXT ·Modf(SB),NOSPLIT,$0
|
|
// special case for f == -0.0
|
|
MOVL f_hi+4(FP), DX // high word
|
|
MOVL f_lo+0(FP), AX // low word
|
|
CMPL DX, $(1<<31) // beginning of -0.0
|
|
JNE notNegativeZero
|
|
CMPL AX, $0 // could be denormalized
|
|
JNE notNegativeZero
|
|
MOVL AX, int_lo+8(FP)
|
|
MOVL DX, int_hi+12(FP)
|
|
MOVL AX, frac_lo+16(FP)
|
|
MOVL DX, frac_hi+20(FP)
|
|
RET
|
|
notNegativeZero:
|
|
FMOVD f+0(FP), F0 // F0=f
|
|
FMOVD F0, F1 // F0=f, F1=f
|
|
FSTCW -2(SP) // save old Control Word
|
|
MOVW -2(SP), AX
|
|
ORW $0x0c00, AX // Rounding Control set to truncate
|
|
MOVW AX, -4(SP) // store new Control Word
|
|
FLDCW -4(SP) // load new Control Word
|
|
FRNDINT // F0=trunc(f), F1=f
|
|
FLDCW -2(SP) // load old Control Word
|
|
FSUBD F0, F1 // F0=trunc(f), F1=f-trunc(f)
|
|
FMOVDP F0, int+8(FP) // F0=f-trunc(f)
|
|
FMOVDP F0, frac+16(FP)
|
|
RET
|