/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ParticleRandom.cpp Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include namespace nw { namespace gfx { #include #include //---------------------------------------- asm f32 ParticleRandom::NextFloatSignedOne() { LDR r2, [r0, #__cpp(offsetof(ParticleRandom, m_Seed))] LDR r3, mix1 LDR r1, mix2 MLA r1, r2, r3, r1 LDR r3, mask STR r1, [r0, #0] AND r2,r3,r1,LSR #16 CLZ r0, r2 AND r12, r1, #0x80000000 LSL r2, r2, r0 // 最上位が1になるまで左に出して RSB r1, r0, #142 // 最上位(17)のときに126 (-1 + 127)になる ADD r2, r12, r2, LSR #8 ADD r2, r2, r1, LSL #23 /// 指数部を設定 VMOV s0, r2 BX lr mix1 DCD 0x343fd mix2 DCD 0x269ec3 mask DCD 0x00007fff } //---------------------------------------- asm f32 ParticleRandom::NextFloatSignedHalf() { LDR r2, [r0, #__cpp(offsetof(ParticleRandom, m_Seed))] LDR r3, mixh1 LDR r1, mixh2 MLA r1, r2, r3, r1 LDR r3, maskh STR r1, [r0, #0] AND r2,r3,r1,LSR #16 CLZ r0, r2 AND r12, r1, #0x80000000 LSL r2, r2, r0 // 最上位が1になるまで左に出して RSB r1, r0, #141 // 最上位(17)のときに126 (-1 + 127)になる ADD r2, r12, r2, LSR #8 ADD r2, r2, r1, LSL #23 /// 指数部を設定 VMOV s0, r2 BX lr mixh1 DCD 0x343fd mixh2 DCD 0x269ec3 maskh DCD 0x00007fff } #include } // namespace gfx } // namespace nw