8023217: Additional floorDiv/floorMod/multiplyExact methods for java.lang.Math

Add new methods with long, int signatures.

Reviewed-by: darcy, scolebourne
This commit is contained in:
Brian Burkhalter 2015-09-29 17:28:44 -07:00
parent 1a2c01a37c
commit 3497da36a2
11 changed files with 382 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -361,7 +361,7 @@ public final class LocalTime
Objects.requireNonNull(zone, "zone");
ZoneOffset offset = zone.getRules().getOffset(instant);
long localSecond = instant.getEpochSecond() + offset.getTotalSeconds();
int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY);
int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY);
return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano());
}